Lemonstand的PHP gettext

Lemonstand的PHP gettext,php,gettext,Php,Gettext,PHP gettext安装在我的web服务器上(运行WAMP)。但是,Lemonstand中包含的字符串不会转换。我有带翻译的.po和.mo文件,但似乎什么也没发生。我的区域设置路径是正确的。我的区域设置PHP代码放在本地化部分中,该部分从法语部分头中调用。以下是我正在使用的代码: $locale = "fr_CA"; if (isset($_GET["locale"])) $locale = $_GET["locale"]; setlocale(LC_ALL, $locale); setloc

PHP gettext安装在我的web服务器上(运行WAMP)。但是,Lemonstand中包含的字符串不会转换。我有带翻译的.po和.mo文件,但似乎什么也没发生。我的区域设置路径是正确的。我的区域设置PHP代码放在本地化部分中,该部分从法语部分头中调用。以下是我正在使用的代码:

$locale = "fr_CA";
if (isset($_GET["locale"]))
$locale = $_GET["locale"];
setlocale(LC_ALL, $locale);
setlocale(LC_TIME, $locale);
putenv("LC_ALL=$locale");
$path = 'locale';
bindtextdomain("default", $path);
textdomain("default");
bind_textdomain_codeset("default", 'UTF-8');
是什么导致了这个问题?我认为这可能是服务器缓存,所以我尝试使用此代码,但仍然没有结果:

$locale = "fr_CA";
$locales_root = "locale";
$domain = "default";
setlocale(LC_ALL, $locale);
setlocale(LC_TIME, $locale);
putenv("LC_ALL=$locale");
$filename = $locales_root.'/'.$locale.'/LC_MESSAGES/'.$domain.'.mo';
$mtime = filemtime($filename); // check its modification time
$filename_new = $locales_root.'/'.$locale.'/LC_MESSAGES/'.$domain.'_'.$mtime.'.mo';
if (!file_exists($filename_new)) {
copy($filename,$filename_new);
}
$domain_new = $domain.'_'.$mtime;
bindtextdomain($domain_new, $locales_root);
textdomain($domain_new);
bind_textdomain_codeset($domain_new, 'UTF-8');
谢谢你的帮助