【问题标题】:PHP gettext: not all strings becomes translatedPHP gettext:并非所有字符串都被翻译
【发布时间】:2010-04-20 17:24:50
【问题描述】:

我有这两行相邻的代码:

<td><?php echo __('Product', 'wpsc'); ?>:</td>
<td><?php echo __('Quantity', 'wpsc'); ?>:</td>

这些翻译在 .po 文件中

msgid "Product"   // Translates
msgstr "Produkt"

msgid "Quantity"  // does not translate
msgstr "Antall"

一个字符串显示在网页上翻译,另一个没有。而且,是的,我尝试更改第一个的翻译并确认翻译相应更改,因此我知道服务器读取了正确的 .mo 文件。 这是在最新的 Ubuntu 服务器上。 知道可能是什么问题吗?

【问题讨论】:

  • 检查数量定义上方的#, fuzzy 行。 gettext 不会翻译模糊字符串
  • 这解决了一切。或者对 msgfmt 使用 -f 选项

标签: php gettext


【解决方案1】:

正如Mark 在他的评论中提到的,检查数量定义上方的#, fuzzy 行。 gettext 不会翻译模糊字符串。

(I'm adding this as an answer so it can get up voted, so that this question gets out of the unanswered queue)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-18
    • 1970-01-01
    • 2011-11-09
    • 2012-05-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多