[prev in list] [next in list] [prev in thread] [next in thread]
List: php-i18n
Subject: [PHP-I18N] Which .mo file is used by PHP gettext?
From: Christophe Chisogne <christophe () publicityweb ! com>
Date: 2003-06-27 14:22:12
[Download RAW message or body]
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
--
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic