-
Notifications
You must be signed in to change notification settings - Fork 9
Description
A standard generated po file gets this warning, for example a random po file from plone.app.locales:
$ msgfmt -c plone/app/locales/locales/sk/LC_MESSAGES/plone.po
plone/app/locales/locales/sk/LC_MESSAGES/plone.po:3: warning: header field 'Language' missing in header
This has been the case for years. It causes no errors for Plone, no translations are missing, but the warning in msgfmt is distracting. I have manually added the Language header in various projects, but it would be good if i18ndude did this automatically. It seems correct to use the same value as we use in the Language-Code header, but I am no specialist.
I guess i18ndude rebuild-pot should add this to the pot file, and then i18ndude sync may automatically add it to the po files already, or we need to add a bit of code for that. A sync should probably leave this header untouched if it is already there.
Actually, I think this could be fixed by adding Language to the DEFAULT_PO_MIME in catalog.py
Same issue was reported years ago for Babel, and fixed in this PR.
I now wonder if the current Language-Code header was an invention by Plone/Zope/i18ndude and only used for the old-style i18n folder. The header was there in the code since the first revision of catalog.py in 2005, and according to the Babel issue, the Language header was only introduced to gettext/po in 2010.
So a search-and-replace from Language-Code to Language could help. For backwards compatibility (with what, I don't know, the i18n folder is not supported since Plone 5.0) we could do them both. But Plone does not need either of these headers, so I don't really expect problems. And an existing unknown header will be left in place by i18ndude sync.
While we are at it, it would be nice if the header could automatically contain the correct code, instead of defaulting to en.