When you run
$ bin/make-messages -l aa_BB -d django
as per http://www.djangoproject.com/documentation/i18n/#how-to-create-language-files and there isn't a conf/locale/aa_BB/LC_MESSAGES already, the resulting django.po has errors of this kind:
...
@@ -1092,7 +1074,7 @@
msgid ""
"There's been an error. It's been reported to the site administrators via e-"
"mail and should be fixed shortly. Thanks for your patience."
-msgstr ""
+msgstr "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: contrib/admin/templates/admin/search_form.html:8
msgid "Go"
@@ -1168,7 +1150,7 @@
#: contrib/admin/templates/admin/filters.html:4
msgid "Filter"
-msgstr ""
+msgstr "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: contrib/admin/templates/admin/change_form.html:22
msgid "View on site"
@@ -1238,7 +1220,7 @@
...
Note the spurious msgstr "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n".
This is because the script strips the header generated by xgettext by droping the first 17 lines. But for some source code files xgettext generates an aditional 18th line with a
Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
header field. After the stripping this line ends right after the last untranslated literal from the previous file, i.e.:
msgid "Filter"
msgstr ""
and either msguniq o msgmerge unificates this
to
msgid "Filter"
msgstr "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
This problem should also affect the generation of conf/locale/en/LC_MESSAGES/django.po. Don't know if this problem can manifest itself when updating a catalog that already has some translations.
Find attached a patch that solves this by searching in the file just generated by xgettext for the first empty line to detect the end of the header.