tickets: 21963
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21963 | 2014-02-06 09:34:43 | 2018-02-26 15:43:21 | 2022-03-06 04:17:51.693139 | Accepted | assigned | Internationalization | Bug | Normal | 1.6 | makemessages still ignores translations in templates with inline comment tags | This bug is claimed to be fixed in #19552, though it's not. 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 | sergeykolosov | Ihor Kaharlichenko <madkinder@gmail.com> | makemessages, template, gettext, xgettext | 0 | 1 | 1 | 0 | 0 | 0 |