问题描述
我有一个中等大小的Django项目,(如果它有任何差异,在AppEngine上运行),并且所有的字符串都应该按照.po文件的形式生活。
I have a medium sized Django project, (running on AppEngine if it makes any difference), and have all the strings living in .po files like they should.
我看到奇怪的行为,某些字符串不翻译。当我运行make_messages时,它们显示在.po文件中,正确的文件位置标记在我的{%trans%}标签的位置。与其任何一方的其他字符串相比,翻译就位并且看起来正确。但是当我显示有关的页面时,大约1/4的字符串根本不会翻译。
I'm seeing strange behavior where certain strings just don't translate. They show up in the .po file when I run make_messages, with the correct file locations marked where my {% trans %} tags are. The translations are in place and look correct compared to other strings on either side of them. But when I display the page in question, about 1/4 of the strings simply don't translate.
挖掘相关的生成的.mo文件,我不看到msgid或者msgstr存在。有没有人看到过与此类似的东西?
Digging into the relevant generated .mo file, I don't see either the msgid or the msgstr present.
任何想法可能发生什么?
Has anybody seen anything similar to this? Any idea what might be happening?
- trans标签正确
- .po文件看起来正确
- 在compile_messages中没有错误
推荐答案
Django,你正在杀我。
Ugh. Django, you're killing me.
这是发生了什么:
由于某种原因Django知道,它决定装饰我的一些翻译与评论'#fuzzy'。它似乎已经选择了哪些标记随机。
For some reason only Django knows, it decided to decorate some of my translations with the comment '# fuzzy'. It seems to have chosen which ones to mark randomly.
无论如何,#fuzzy意味着:不要翻译这个,即使这是翻译:
Anyway, #fuzzy means this: "don't translate this, even though here's the translation:"
我会在这里离开这里,以防将来有一些其他可怜的灵魂碰巧。
I'll leave this here in case some other poor soul comes across it in the future.
这篇关于Django缺少某些字符串的翻译。任何想法为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!