views:

223

answers:

2

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.

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.

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 tags look correct
  • .po files look correct
  • no errors during compile_messages
+2  A: 

Ugh. Django, you're killing me.

Here's what was happening:

http://blog.e-shell.org/124

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.

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.

Jason Kester
+3  A: 

The fuzzy marker is added to the .po file by makemessages. When you have a new string (with no translations), it looks for similar strings, and includes them as the translation, with the fuzzy marker. This means, this is a crude match, so don't display it to the user, but it could be a good start for the human translator.

It isn't a Django behavior, it comes from the gettext facility.

Ned Batchelder