PHP:gettext是否需要LC_MESSAGES目录? [英] PHP: does gettext require LC_MESSAGES dirs?
本文介绍了PHP:gettext是否需要LC_MESSAGES目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要翻译我的PHP应用程序,请使用gettext模块中的compile.这是根据文档进行翻译的目录树:
To translate my PHP app I use compiled in gettext module. Here is a directory tree of translations made according to docs:
locale/
cs_CZ/
LC_MESSAGES/
messages.po
messages.mo
de_DE/
LC_MESSAGES/
messages.po
messages.mo
fr_FR/
LC_MESSAGES/
messages.po
messages.mo
问题:是否可以摆脱LC_MESSAGES目录?如果使用这种结构,PHP能够找到翻译吗?
Question: is it possible to get rid of LC_MESSAGES catalog? Will PHP be able to find translations if I use this structure?
locale/
cs_CZ/
messages.po
messages.mo
de_DE/
messages.po
messages.mo
fr_FR/
messages.po
messages.mo
我的翻译转换PHP:
<?php
setlocale(LC_ALL, 'fr_FR.UTF-8');
bindtextdomain("messages", "locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
?>
谢谢.
推荐答案
唯一可行的解决方法是在每个语言子目录中创建符号链接LC_MESSAGES -> .
. (但这会使PHP应用程序的安装复杂化.FTP很少会创建符号链接.)
The only feasible workaround is creating a symlink LC_MESSAGES -> .
in each language subdirectory. (But this complicates PHP application installation. FTP seldomly can create symlinks.)
这篇关于PHP:gettext是否需要LC_MESSAGES目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文