Making i18n work on all Unix webservers ?

Chichi <[email protected]>
Newsgroups gmane.comp.php.internationalization
Message-ID <[email protected]>
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
Tel +32(0)61/27.14.80


-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.