Gettext, PHP and Windows 2008
I have a Windows 2008 server (installed in italian). It runs Zend Server CE 5.1, which is Apache2.2 and PHP 5.3.5.
I created this simple script:
putenv("LC_ALL=de_DE");
bindtextdomain('messages', './langs');
textdomain('messages');
echo _("Hello world");
The directories are:
/lang
/it_IT
/LC_MESSAGES
/messages.mo
/messages.po开发者_如何学编程
/de_DE
/LC_MESSAGES
/messages.mo
/messages.po
What I get is the italian message, not the german one.
It seems that putenv()
has no effect.
Please note that the language directory structure is correct, since the it_IT
file is correctly loaded.
How can I load the german translation?
Not all locales are supported on windows. Also locale names are different on windows too. Supported languages and regions are listed on microsoft sites. If you're developing on windows machine and your production server is on linux i think you should consider using Zend_Translate
精彩评论