Hi!
Today I ran python scripts/manage_translations.py update_catalogs
from the root of the django project, but it looks like it removed some comments, I’m slowly digging and found that there’s something to do with xgettext and line breaks, maybe the specific version of xgettext I’m using? I’m using:
$ xgettext --version
xgettext (GNU gettext-tools) 0.22.5
from a Debian testing.
I’m working in humanize.py and if I keep the original lines like:
past_substrings = {
# Translators: 'naturaltime-past' strings will be included in '%(delta)s ago'
"year": npgettext_lazy(
"naturaltime-past", "%(num)d year", "%(num)d years", "num"
),
then the Translators comment is not picked up by my xgettext (while it was in the po file, so it was previously picked-up by someone else xgettext) (I copied the xgettext call from an strace):
$ xgettext "-d" "django" "--language=Python" "--keyword=gettext_noop" "--keyword=gettext_lazy" "--keyword=ngettext_lazy:1,2" "--keyword=pgettext:1c,2" "--keyword=npgettext:1c,2,3" "--keyword=pgettext_lazy:1c,2" "--keyword=npgettext_lazy:1c,2,3" "--output=-" django/contrib/humanize/templatetags/humanize.py "--from-code=UTF-8" "--add-comments=Translators" | grep -c Translators
18
But if I change the line to be:
past_substrings = {
# Translators: 'naturaltime-past' strings will be included in '%(delta)s ago'
"year": npgettext_lazy("naturaltime-past", "%(num)d year", "%(num)d years", "num"),
then the comment is picked up (see the 18 comments becoming 19 comments):
$ xgettext "-d" "django" "--language=Python" "--keyword=gettext_noop" "--keyword=gettext_lazy" "--keyword=ngettext_lazy:1,2" "--keyword=pgettext:1c,2" "--keyword=npgettext:1c,2,3" "--keyword=pgettext_lazy:1c,2" "--keyword=npgettext_lazy:1c,2,3" "--output=-" django/contrib/humanize/templatetags/humanize.py "--from-code=UTF-8" "--add-comments=Translators" | grep -c Translators
19