David Louda
David Louda

Reputation: 577

Why is gettext giving me automatically incorrect translations?

I am using gettext translations for my Django project and I keep adding to the .po file new and new translations by makemessages and compilemessages. What is happening now is that when I make messages then I check the .po file and there many of the strings have been automatically translated, although this is 100% unique string.

example: Now generated:

#: .\agregator\models.py:1855
#, fuzzy
#| msgid "Distribution order"
msgid "Distribution Product Parameters"
msgstr "Objednávka u distribuce"

it automatically translated according to the msgid "Distribution order" that is not any close to the actual string neither there is any link to this msgid.

Can anyone explain to me what is happening in the background and how can I remove all such links so for msgstr I get only empty strings, (unless the strings are 100% similar)? Thank you in advance.

My tip is that the msgid is allocated based on fragments of strings, looking for the "best match". If this was the case - how to stop this behaviour?

Upvotes: 0

Views: 314

Answers (1)

Guido Flohr
Guido Flohr

Reputation: 2340

If msgmerge finds translations for similar strings, it will suggest them as "fuzzy". This is what you see here.

Fuzzy translations are not meant to be used/deployed by your application. If you compile your .po file into an .mo file with msgmerge (this is what compilemessages probably does) these fuzzy translations are ignored.

Just leave the fuzzy translations in the .po file. They don't hurt and they make future translations easier because the translator does not have to translate from scratch but correct the auto-suggested translation instead.

Upvotes: 1

Related Questions