空字符串的转换显示po头

2024-06-16 09:41:19 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图翻译django模板中的空字符串时,我的结果是po头显示为空字符串http://codex.wordpress.org/Translating_WordPress#The_PO_File_Header。 我必须翻译空字符串,因为它们在数据库中,我不能填充所有的模型,因为它们是动态的。 现在我用的是

{% if data %}
    {% trans data %}
{% endif %}

我试着把标题标为模糊,但没用。在

有什么方法可以避免检查每个可翻译字符串并避免出现采购订单头? 我使用的是django1.5。在


Tags: thedjango字符串org模板httpdatawordpress
1条回答
网友
1楼 · 发布于 2024-06-16 09:41:19

好的,根据Why does gettext translate an empty string to the .po header text?找出发生了什么 和http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files

Having the original strings sorted enables the use of simple binary search, for when the MO file does not contain an hashing table, or for when it is not practical to use the hashing table provided in the MO file. This also has another advantage, as the empty string in a PO file GNU gettext is usually translated into some system information attached to that particular MO file, and the empty string necessarily becomes the first in both the original and translated tables, making the system information very easy to find.

所以我不能不检查绳子。在

相关问题 更多 >