Michiel Sikma wrote:
On 19 April 2010 00:55, Andre Polykanine <an...@oire.org> wrote:
Now the i18n process is made as follows: we set a cookie on the site
and depending on it we select the language to display the site in. We
have three (currently) interface files: rus.lng, ukr.lng, and enu.lng
(for English US). the format is the following:
define ("MSG379", "Welcome!");
You might want to consider making the language dependent on the URL, e.g.
http://site.com/ru/pagename for Russian. Doing it this way certainly isn't a
bad solution, but I do strongly recommend against using define() and using
anonymous translation keys. Usually, you have one base language (which is
usually English due to its lack of special characters and ubiquity) from
which you work. You then either simplify your keys, e.g. 'user_welcome' =>
'Welcome, %1$s!', or make the keys the proper base language strings so you
can wrap everything in a language function.
In the latter case, you might have something like <p><?= _('Welcome, %1$s!',
$username); ?></p>, and then if the current language is not English, the _()
function will make the appropriate lookup.
Unless you have namespaces (and I can't remember if they completed
namespaced based functions) then don't use something so commuon as a
function named underscore :/
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php