Re: How to do i18n better?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andre Polykanine wrote:
Hi everyone,

I posted this in the PHP-i18n list, however got no answer so trying
here).
We are making a blog platform (http://oire.org/) which is provided in
several languages (currently they are Russian, Ukrainian, and
English).
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!");
etc. I know that PHP does support somehow exporting the strings into a
.pod file. Maybe it would be better to do that? If so, how can I do
it?
Could you suggest me maybe a better solution than we currently have?
Thanks a lot!

A lot of systems just use conditional includes and a language array. So the following:

Some main file:
<?php

    $lang = tell_me_what_the_lang_code_is();
    require_once( "lang/messages.$lang.php" );

?>

And then in lang/messages.eng.php:
<?php

$messages['Welcome!']    = 'Welcome!';
$messages['login-label'] = 'Login:';
$messages['blah-blah']   = 'Blah blah';

?>

And then in lang/messages.fra.php you might have:
<?php

$messages['Welcome!']    = 'Bienvenu!';
$messages['login-label'] = 'Accès :';
$messages['blah-blah']   = 'Le blah blah';

?>

There's lots of variations on this also, but the above is a very common method.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux