dousigan0499 2018-11-03 13:00
浏览 134

php gettext忽略了语言环境

I have a very strange problem: I am using a podcast solution called "Podcast Generator" (podcastgenerator.net), and installed on one server the gettext based translation is working perfect (www.fegertest.de/podcasts), while on the other server it simply won't translate (www.feg-erlangen.de/podcasts).

I checked already the following things:

  • Locale is correctly configured in configuration file
  • gettext is installed on both servers
  • locale de_DE of browser is available
  • php version is 7 on both servers
  • locale is correctly set in the code

$locale="de_DE";
if (!ini_get('safe_mode')) 
    putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain($domain, LOCALE_DIR);
bind_textdomain_codeset($domain, $encoding); //encoding
textdomain($domain);

I have no idea what else could be the reason for it... Any ideas out there?

  • 写回答

1条回答 默认 最新

  • dongxidui1227 2018-11-04 19:59
    关注

    The locale "de_DE" has to be installed on the server. Run "locale -a grep de_DE" to verify that.

    Besides, the environment variable LC_ALL may not be the right one to set. Set LANG, LANGUAGE, and LC_MESSAGES as well. See http://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-runtime/ABOUT-NLS and read the section "1.2 Using This Package" that explains the exact meaning of the various environment variables in great detail.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料