PHP gettext:并非所有字符串都已翻译 [英] PHP gettext: not all strings becomes translated
本文介绍了PHP gettext:并非所有字符串都已翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这两行相邻的代码:
I have these two adjacent lines of code:
<td><?php echo __('Product', 'wpsc'); ?>:</td>
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>
这些翻译在.po文件中
And these translations in the .po file
msgid "Product" // Translates
msgstr "Produkt"
msgid "Quantity" // does not translate
msgstr "Antall"
一个字符串显示在网页上,而另一个则没有.而且,是的,我尝试过更改第一个的翻译,并确认翻译也进行了相应的更改,因此我知道服务器读取了正确的.mo文件. 这是在最新的Ubuntu服务器上. 知道可能是什么问题吗?
One string shows up translated on the webpage, the other not. And, yes I have tried to change the translation of the first one and confirmed that the translation changes accordingly, so I know the server reads the correct .mo file. This is on an up to date Ubuntu server. Any idea about what may be the problem?
推荐答案
在他的评论中提到的马克,请检查数量定义上方的行#, fuzzy
. gettext不会翻译模糊字符串.
As Mark mentioned in his comment, check for the line #, fuzzy
above the Quantity definition. gettext won't translate fuzzy strings.
( 查看全文