gettext가 작동했지만 갑자기 번역되지 않습니다. 나는 무슨 일이 일어나는지 알아 낸다. 나는 /sys/locale/no_NO/LC_MESSAGES/messages.po
을 사용하여 페이지를 노르웨이 언어로 번역하려고합니다.gettext 설정이 작동하지 않습니다.
putenv("LANG=ja_JP.UTF-8");
setlocale(LC_MESSAGES, 'ja_JP.UTF-8');
bindtextdomain('messages', '../locale');
bind_textdomain_codeset('messages', 'UTF-8');
textdomain('messages');
:
/public/home.php
$locale = "en_US";
if (isSet($_COOKIE['lang'])) $locale = $_COOKIE['lang'];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "../sys/locale");
textdomain("messages");
echo "<p>locale: " . $locale . " ";
echo gettext("Home");
exit();
이 내가 다음을 수행해야
locale: no_No Home
때 일본으로 locale: no_No Hjem
'putenv ("LANG = $ locale");'을 추가하십시오. 이것이 최종 레벨 환경 변수 gettext 프로브이지만 때로는 도움이됩니다. 'LC_ALL ='보다 우선 순위가 높고'no_No : nl_NL : en_GB' 대안을 허용하는'LANGUAGE =' – mario