-
Notifications
You must be signed in to change notification settings - Fork 468
Description
First of all my apologies, I'm neither a developer nor a native speaker of English, please excuse all the inaccuracies below.
In our project exelearning.net we use pybabel. I'm the coordinator of the translation teams, and some months ago found out that msgfmt had started producing warnings that a header field was missing in our PO files (see bug ticket https://forja.cenatic.es/tracker/?func=detail&atid=883&aid=1905&group_id=197). I searched the changelog of gettext and found out that in 2010 a new header field had been introduced, Language.
Documentation about the new header (from /usr/share/doc/gettext/NEWS)
Version 0.18 - May 2010
- (...)
- PO file format:
There is a new field 'Language' in the header entry. It denotes the language
code (plus optional country code) for the PO file. This field can be used
by automated tools, such as spell checkers. It is expected to be more
reliable than looking at the file name or at the 'Language-Team' field in
the header entry.
msgmerge, msgcat, msgen have a new option --lang that allows to specify
this field. Additionally, msgmerge fills in this new field by looking at
the 'Language-Team' field (if the --lang option is not given).
Does this gettext issue have anything to do with pybabel? Well, yes. Even if I added by hand the field to all our PO files, anytime we did a 'pybabel extract' and 'pybabel update' the field disppeared.
Pedro Peña prepared a patch for babel 1.3 that solved the problem for us
diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py
index 501763b..e26e8f0 100644
--- a/babel/messages/catalog.py
+++ b/babel/messages/catalog.py
@@ -349,7 +349,10 @@ class Catalog(object):
else:
headers.append(('Language-Team', self.language_team))
if self.locale is not None:
-
headers.append(('Language', str(self.locale))) headers.append(('Plural-Forms', self.plural_forms)) -
else: -
headers.append(('Language', 'LANGUAGE')) headers.append(('MIME-Version', '1.0')) headers.append(('Content-Type', 'text/plain; charset=%s' % self.charset))
Please check the patch and add it to your sources, or else find a different way to support the not-so-new header field.