|
Posted by P Pulkkinen on 02/06/07 14:33
Hi all, I am in a php development project and I would like to hear your
opinions on language file practises.
1) One huge or many small?
====================================
Currently we have one big per language, like en.php or fi.php. Since I
expect this app to grow, I have started to think we should have different
file for every output page or widget in the application.
2) "Best" syntax
====================================
Currently every language file is an associative array like this:
<?php
$lang = array (
"push_this" = "Push this",
"push_that" = "Push that"
);
?>
So the keys are as descriptive as possible to ease up the work of
translators. Since only one language file gets included, only one
$lang-array exist in global namespace. Some use just generic keys like
"expr_234" = "Push that" but they are not very descriptive.
It could also be possible to use typical configuration syntax (one key and
value per line)
push_this = "Push this"
push_that = "Push that"
which would not be php, but then some functions would read the file and
turn the content into an array.
3) Or, have someone found a database to be better for some reason
===============================================
I don't remember any case from apps I have downloaded, but
I wouldn't be surprised if SOMEONE somewhere prefers
this solution.
So, now your opinions and experiences :-) This is not an
"i-have-a-huge-problem"-issue, but just part of every coders everlasting
quest to find the best practises :-)
Navigation:
[Reply to this message]
|