我试图将所有_('gettext')
函数调用的脚本扫描到新的PoEdit目录中。解析文件后,它会显示此错误:PoEdit .PO生成错误
Filename.class.php:11: warning: Although being used in a format string position, the msgid is not a valid PHP format string. Reason: In the directive number 1, the character '"' is not a valid conversion specifier.
Filename.class.php,第11行是这样的:
throw new fatalException(sprintf(_('The chosen directory "%" does not exist.'), $dir));
仍会生成.MO文件,但没有翻译的文本出现在网站上。显示调用_('gettext')
内部的原始文本。这可能是问题所在,还是有其他原因(例如不正确setlocale()
信息)翻译不起作用?有人能告诉我上面的错误信息是什么意思吗?
在我的本地主机上用PHP 5.3.8和Apache 2.2.17在WAMP Server 2.1上运行Windows。
谢谢。
现在,如果您更新了.po,.mo并重新启动了Web服务器,那么现在的msgid已经发生了变化? – dsas
@dsas是的,一切都已完成。生成文件/重新启动Apache时没有错误报告。 – Pete171
我也检查过我的'setlocale()'函数,它没有返回false。 Gettext扩展已启用... – Pete171