Which .mo file is used by PHP gettext?

From: Date: Fri, 27 Jun 2003 14:22:12 +0000
Subject: Which .mo file is used by PHP gettext?
Groups: php.i18n 
Request: Send a blank email to php-i18n+get-586@lists.php.net to get a copy of this message
Is there some mean to know exactly where the domain.mo file will be search for ? I mean, for a locale accepting aliases, where will the .mo file be searched, and in which order ? I couldn't find this precisely in PHP manual (user comments), and my translations don't work all the time (not for all languages at least) (I know, I must restart apache to avoid using the gettext cache) Ex on a typical Linux server, for french, locales accepted by setlocale PHP call are "french", "fr_BE", "fr_FR", "fr_BE.ISO_8859-1", "fr_BE.ISO-8859-1", but not "fr" (depending on loale.alias of course) On a Win2000 server, it rather looks like this: "french", "French", "French_Belgium.1252", "fr" but not "fr_BE", "fr_FR" The only common one seems to be "french" on both platforms. As I wanted to maintain only one .po file by language, I choosed "french" as locale name and as directory for mo file (./locale/french/LC_MESSAGES/domain.mo), for both platforms, and it finally worked. Assuming my domain in bound to "./locale" and domain is "messages", the .mo file will be search in ./locale/xxx/LC_MESSAGES/messages.mo but what are the xxx ? Ex for locale "french", xxx=french give expected results, not always xxx=fr.
     for "fr_FR", it seems to search for xxx=fr_FR and then xxx=fr.
Ex for locale "dutch", xxx=nl_NL works on Linux, but xxx=dutch won't translate messages...
What's the most correct/robust way to setup these directories ? Besides this, for french example, I simply used setlocale(LC_ALL,'french') and everything was ok, on Linux But with Win2000 as server, I had to use putenv("LANG=fr"); setlocale(LC_ALL,'french'). This worked for french, but not for dutch anymore. Perhaps I should set up some other obscure env vars ? And setlocale(LC_ALL,'') seems to give detailed results on linux only when I first use 'putenv(LC_MESSAGES,"fr_FR")'. I feel I'll become mad very soon... Could someone tell me exactly how it works (preferably on both platforms), or give me pointers to precise docs so I could stop loosing all my hair ? (I already read gettext GNU manual but it doesn't really help that much) Thanks in advance. Christophe, http://www.publicityweb.com

« previous php.i18n (#586) next »