Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#18183 closed Bug (invalid)

django-admin makemessages generates new locales (LC_MESSAGES/django.po) with PO template markers

Reported by: Guttorm Flatabø Owned by: nobody
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords: gettext, translation, .po
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Newly generated locales files made by django-admin makemessages have "#, fuzzy" before the fist empty translation entry before the header, thus composing:

#, fuzzy
msgid ""
msgstr ""

(If you remove the fuzzy marker manually it will not be re-added on later updates of the translation)

See example here. According to Translatewiki founder and administrator Nike this seems to be the only way of marking a po template file (apart from the "pot" file name ending). It can thus confuse applications and services such as translatewiki when a translation message file (django.po) looks like a template.

I have been unable to find an "official" mention of what defines a PO Template file, probably because there is none. However, this gettext guide seems to indicate the same kind of using "#, fuzzy" as a template marker.

The locale files made by django-admin makemessages are not supposed to be po template files, and I thus suggest that you try to produce them without the fuzzy marker on the line before the first empty entry (before the header).

I suppose the marker is added by the gettext tools used by django-admin makemessages and that the easiest solution is to have the string be removed as part of the script.

Change History (4)

comment:2 Changed 5 years ago by Ramiro Morales

AFAIK the header is an otherwise normal translatable literal (a multi-line one that's why it starts with a msgstr "" line).

The #, fuzzy marker isn't put there by the Django wrapper but by the official GNU gettext tools which we use at the low level. The markers are added when PO files are created for the first time because some fields of the header are prefilled but there are others that need intervention of a translator, so it is in a incomplete state.

The translator (or the translation tools she uses) is supposed to remove them once she updates the fields of the header contained in such msgstr.

The header needs to be completed by the translator because otherwise the msgfmt(1) GNU gettext tool will emit warning/errors when trying to convert them to .mo files.

Last edited 4 years ago by Ramiro Morales (previous) (diff)

comment:3 in reply to:  1 Changed 5 years ago by Ramiro Morales

Resolution: invalid
Status: newclosed

Replying to dittaeva:

Here's another site indicating the use of #,fuzzy before first emtpy entry and header as a template marker.

Hrm, actually I don't see anything in that document that supports such affirmation/convention. It actually says the same thing I wrote in my previous comment regarding the fact that users needs to edit the header of PO files and remove the corresponding fuzzy marker.

I'm closing the ticket. Please reopen if you disagree and have any additional insight/references to revert this decision.

Last edited 4 years ago by Ramiro Morales (previous) (diff)

comment:4 Changed 5 years ago by Guttorm Flatabø

Thank you very much for that most enlightening comment!

I do not think I have additional insight/references that justify reopening this issue. However, the underlying reason why this is a problem for us is that django doesn't provide a pot-file, but I suppose there are good reasons for that too :)

One could also argue that django should be able to update the header and prepare the file for translation, thus removing the fuzzy tag. makemessages already overwrites the "Report-Msgid-Bugs-To" value for some reason.

Note: See TracTickets for help on using tickets.
Back to Top