php Gettext in windows path


php Gettext in windows path

嗨,我正在尝试在窗口中使用 gettext。此代码在 Linux 上运行良好,但在 Windows 中不起作用。问题是它找不到区域设置文件夹的路径。有什么建议吗?

<?php
// I18N support information here
$language = 'pt_BR';
putenv("LANG=$language"); 
setlocale(LC_ALL, $language);
// Set the text domain as 'messages'
$domain = 'messages';
bindtextdomain($domain, './locale'); 
textdomain($domain);
echo gettext("A string to be translated would go here");

?>

如果我将代码放置为,

 c:'temp'test.php

和资源文件为

 c:'temp'locales'pt_BR'LC_MESSAGES'messages.mo

我通过在同一目录中制作 messages.po 来制作 message.mo 文件,然后在 Poedit 上编辑文件,添加"要翻译的字符串将转到此处"的翻译(我不懂葡萄牙语,所以它是虚拟文本),保存(作为 .mo)。