Django Internationalization Common pitfalls

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

fuzzy translations

Sometimes makemessages may think that the string it found for translation is somewhat similar to already existing translation. It will when mark it in the .po file with a special fuzzy comment like this:

#: templates/randa/map.html:91
#, fuzzy
msgid "Country"
msgstr "Länderinfo"

Even if translation is correct or you updated it to correct one it will not be used to translate your project unless you remove fuzzy comment line.

Multiline strings

makemessages parses files in various formats, from plain text to python code and it is not designed to follow every possible rule for having multi-line strings in those formats. Most of the time it will work just fine with single line strings but if you have construction like this:

translation = _("firstline"
"secondline"
"thirdline")

It will only pick up firstline for translation. Solution for this is to avoid using multiline strings when possible.



Got any Django Question?