简体   繁体   English

获取文本,PHP 和 Windows 2008

[英]Gettext, PHP and Windows 2008

I have a Windows 2008 server (installed in italian).我有一个 Windows 2008 服务器(以意大利语安装)。 It runs Zend Server CE 5.1, which is Apache2.2 and PHP 5.3.5.它运行 Zend Server CE 5.1,即 Apache2.2 和 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.似乎putenv()没有效果。 Please note that the language directory structure is correct, since the it_IT file is correctly loaded.请注意语言目录结构是正确的,因为it_IT文件已正确加载。

How can I load the german translation?如何加载德语翻译?

Not all locales are supported on windows. windows 并不支持所有语言环境。 Also locale names are different on windows too. windows 上的语言环境名称也不同 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如果您在 windows 机器上开发并且您的生产服务器在 linux 上,我认为您应该考虑使用Zend_Translate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM