我試圖將所有_('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