django模糊字符串翻译没有出现 [英] django fuzzy string translation not showing up
问题描述
为什么有时我会在
django.po
语言文件中得到一个fuzzy
项.实际上,我已经在我的项目中检查了fuzzy
字符串项是完全唯一的.
Why sometimes I get a
fuzzy
item indjango.po
language file. Actually, I have checked in my project thefuzzy
string item is totally unique.
#: .usersviews.py:81 .usersviews.py:101
#, fuzzy
msgid "username or email"
msgstr "9988"
模糊是可以的,但我翻译的模糊项目没有显示在页面上,只有英文版本显示.太奇怪了.
It is ok to be fuzzy but my translation of fuzzy item not showing up on the page, only English version shows up. It is totally odd.
推荐答案
msgmerge
将字符串标记为fuzzy
如果旧目录对具有类似msgid
的字符串进行了翻译.它还将标记为模糊的字符串从旧目录转移到新目录.
msgmerge
marks strings asfuzzy
if the old catalog had a translation for a strings with a similar-lookingmsgid
. It also carries over strings marked as fuzzy from an old catalog to a new one.
msgfmt
从编译目录中排除模糊消息,因为翻译可能不正确.翻译人员应检查翻译的正确性(在您发布的情况下,空字符串显然是不正确的翻译),并在验证翻译时删除 fuzzy
标记.如果您绝对想使用模糊翻译,请将 --use-fuzzy
传递给 msgfmt
:
msgfmt
excludes fuzzy messages from the compiled catalog, as the translations are likely incorrect. The translator should check correctness of the translation (in the case you posted, an empty string is clearly an incorrect translation), and remove the fuzzy
mark when the translation is is verified. If you absolutely want to use fuzzy translations, pass --use-fuzzy
to msgfmt
:
python manage.py compilemessages --use-fuzzy
这篇关于django模糊字符串翻译没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!