#19552: makemessages ignores translations in templates with inline comment tags -------------------------------------+------------------------------------- Reporter: juneih@… | Owner: nobody Type: Bug | Status: new Component: | Version: 1.4 Internationalization | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: makemessages, | Needs documentation: 0 template, gettext, xgettext | Patch needs improvement: 0 Has patch: 1 | UI/UX: 0 Needs tests: 0 | Easy pickings: 1 | -------------------------------------+------------------------------------- Changes (by Ihor Kaharlichenko <madkinder@…>):
* status: closed => new * resolution: fixed => Comment: Unfortunately the bug seems to be fixed partially. Here's the test case: Template: {{{ #!django {% load i18n %} {# Translators: Abbreviated month name #} {% trans "Jan" %} {# Translators: Abbreviated month name #}{% trans "Feb" %} {% comment %}Translators: Abbreviated month name{% endcomment %}{% trans "Mar" %} {# Translators: Abbreviated month name #} {% trans "Apr" %} {% comment %}Translators: Abbreviated month name{% endcomment %} {% trans "May" %} {# Translators: Abbreviated month name #} {% trans "Jun" %} {# Translators: Abbreviated month name #} {% trans "Jul" %} {% comment %}Translators: Abbreviated month name{% endcomment %} {% trans "Aug" %} }}} The extraction session: {{{ $ ./manage.py version 1.6.1 $ ./manage.py makemessages -l ru -i venv .../trans_real.py:585: TranslatorCommentWarning: The translator-targeted comment 'Translators: Abbreviated month name' (file app1/templates/i18n_test.html, line 6) was ignored, because it wasn't the last item on the line. warnings.warn(warn_msg, TranslatorCommentWarning) .../trans_real.py:585: TranslatorCommentWarning: The translator-targeted comment 'Translators: Abbreviated month name' (file app1/templates/i18n_test.html, line 10) was ignored, because it wasn't the last item on the line. warnings.warn(warn_msg, TranslatorCommentWarning) processing locale ru }}} Resulting po file: {{{ #!po #. Translators: Abbreviated month name #: app1/templates/i18n_test.html:4 msgid "Jan" msgstr "" #: app1/templates/i18n_test.html:6 msgid "Feb" msgstr "" #. Translators: Abbreviated month name gettext(u'Mar') #: app1/templates/i18n_test.html:10 msgid "Apr" msgstr "" #. Translators: Abbreviated month name gettext(u'May') #. Translators: Abbreviated month name #: app1/templates/i18n_test.html:15 msgid "Jun" msgstr "" #. Translators: Abbreviated month name #: app1/templates/i18n_test.html:19 msgid "Jul" msgstr "" #. Translators: Abbreviated month name #: app1/templates/i18n_test.html:23 msgid "Aug" msgstr "" }}} The problems: * translations for "Mar" and "May" were completely skipped * there was a warning for single-tag comments (for Feb and Apr), but not for block comments (for Mar and May), which is inconsistent * Apr and Jun got wrong comments -- Ticket URL: <https://code.djangoproject.com/ticket/19552#comment:11> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/083.8afc4e57fc4364481525cb988d2fea4c%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.