1
0
mirror of https://github.com/django/django.git synced 2024-12-27 11:35:53 +00:00
django/tests/regressiontests/i18n/commands/templates/comments.thtml
Ramiro Morales 47ddd6a408 Fixed #19552 -- Enhanced makemessages handling of `{# #}`-style template comments.
They are simply ignored now. This allows for a more correct behavior when
they are placed before translatable constructs on the same line.

Previously, the latter were wrongly ignored because the former were
preserved when converting template code to the internal Python-syntax
form later fed to xgettext but Python has no ``/* ... */``-style
comments.

Also, special comments directed to translators are now only taken in
account when they are located at the end of a line. e.g.::

  {# Translators: ignored #}{% trans "Literal A" %}{# Translators: valid, associated with "Literal B" below #}
  {% trans "Literal B" %}

Behavior of ``{% comment %}...{% endcomment %}``tags remains unchanged.

Thanks juneih at redpill-linpro dot com for the report and Claude for
his work on the issue.
2013-01-29 19:13:23 -03:00

14 lines
920 B
Plaintext

{% load i18n %}
{# ignored comment #1 #}{% trans "Translatable literal #9a" %}
{# Translators: ignored i18n comment #1 #}{% trans "Translatable literal #9b" %}
{# Translators: ignored i18n comment #2 #}{# ignored comment #2 #}{% trans "Translatable literal #9c" %}
{# ignored comment #3 #}{# Translators: ignored i18n comment #3 #}{% trans "Translatable literal #9d" %}
{# ignored comment #4 #}{% trans "Translatable literal #9e" %}{# ignored comment #5 #}
{# Translators: ignored i18n comment #4 #}{% trans "Translatable literal #9f" %}{# Translators: valid i18n comment #5 #}
{% trans "Translatable literal #9g" %}{# Translators: valid i18n comment #6 #}
{# ignored comment #6 #}{% trans "Translatable literal #9h" %}{# Translators: valid i18n comment #7 #}
{% trans "Translatable literal #9i" %}
{# Translators: valid i18n comment #8 #}{# Translators: valid i18n comment #9 #}
{% trans "Translatable literal #9j" %}