Would you rather use mySQL database to store language variables or php variables?
Please consider
- Performance
- Adding
- Editing
and how would you do it? Store it to php variables, for example
$language['en']["hello"] = "Hello";
$language['cz']["hello"] = "Ahoj";
and use function
function l($lvar)
{
global $language, $default_language;
return $language[$default_language][$lvar];
}
and use it like
<div id="test">
<?php echo l("hello"); ?>
</div>
? What is better?
And what about to store them in database and every time (or once 10 minutes) create (generate) php file with variables
It depends on some things:
Do you want persistence (e.g. do you want the variables to be stored once, and then retrieved)?
If you want peristence then you should go with MySQL (or some XML/YAML file), to store up your data, so that even if you edit your code in someway or migrate to another language it is not lost.
Do you want easy editing?
If you save your data in a php file, external editing can be hard as you either have to rewrite that file or you have to someway save the newer changes. It is easier to change something store in an SQL-table than in a code file.
In the end I personally would prefer an external storage for easier migration, and simpler editing.