Django缺少某些字符串的翻译。任何想法为什么?

编程入门 行业动态 更新时间:2024-10-25 02:30:46
本文介绍了Django缺少某些字符串的翻译。任何想法为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个中等大小的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.

这是发生了什么:

blog.e-shell/124

由于某种原因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缺少某些字符串的翻译。任何想法为什么?

本文发布于:2023-11-06 09:50:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563361.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   想法   Django

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!