Working with Django, you can use django.utils.translation.ugettext
and ....ugettext_lazy
(as well as some template tags) to handle translation of localized messages.
Later, with command: django-admin.py makemessages -l <LANGUAGE>
you can generate the po
file containing the original string, so that the developer can specify the desired translation.
Question: is there a django command, or any other quick way, to find out which messages have not been translated?
Usually I look for the string msgstr ""
in the po
file, but that's inaccurate, since some translations are multiline, like the following:
#file.py:xyz
msgid ""
"Some very long text"
msgstr ""
"The translation of some very long text"
Thus, looking for msgstr ""
I get "false positives" (i.e. strings that are actually translated, but whose translation start the next line). With thousand of lines, this quite often.
Any smart suggestion?
Thanks
Assuming you are using some popular editors:
msgstr ""\n\n
msgstr ""\r\n\r\n
sed -i '/msgstr ""/{N;N; s/\n\n/\n# translate me!\n\n/g}' django.po
and then search for # translate me!
comments in the file.