With the following code to translate messages in french, we need to put the mo files in a directory like

./local/xxx/LC_MESSAGE/messages.{mo,po}

        putenv("LANGUAGE=french");
        setlocale(LC_ALL, 'fr_BE');
        bindtextdomain("messages", "./local");
        textdomain("messages");
        echo '<br>' . _("Yes");

On one linux webserver, xxx must be 'fr' (and LANGUAGE set).
On another linux webserver, xxx must be 'french' (no var to set).

How can I guess which xxx to use, for my code to work on
any webserver ? Other solution than using 3 or more directories
like 'fr', 'french', 'fr_BE', and copying it?
In fact, I'd like to make it work on windows servers too...

And how can I guess which env var to set (or not) and in
which order (LC_ALL, LANG, LANGUAGE, ...) ? Is there a way
to do it for the code to work nearly everywhere ?
I'll use a class to hide that complexity.

Can someone help ? The PHP documentation is far from beeing
clear and precise enough in that particular field.

---
Christophe Chisogne
Developper, Publicityweb sprl
http://www.publicityweb.com



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



Reply via email to