diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-03-19 12:56:38 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-03-19 12:56:38 +0000 |
| commit | 775a6e694fedc6b057dc560da8e4a07dc7e9457c (patch) | |
| tree | 52317f6c598f5952e1fee06fd672468ad2aeb12d /tests | |
| parent | 1a6d98dab97df7e4bfc6fd9c82183eb9a1349078 (diff) | |
Fixed #15632 -- Ignore unrelated content in template multi-line comment blocks when looking for tokens that identify comments for translators. Thanks andrew AT ie-grad DOT ru for the report and Claude Paroz for spotting the problem and helping to fix it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/i18n/commands/extraction.py | 14 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/commands/templates/test.html | 46 |
2 files changed, 58 insertions, 2 deletions
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py index 1f36b8a9b4..0d70d2641d 100644 --- a/tests/regressiontests/i18n/commands/extraction.py +++ b/tests/regressiontests/i18n/commands/extraction.py @@ -49,7 +49,19 @@ class BasicExtractorTests(ExtractorTests): self.assertTrue('This comment should not be extracted' not in po_contents) # Comments in templates self.assertTrue('#. Translators: Django template comment for translators' in po_contents) - self.assertTrue('#. Translators: Django comment block for translators' in po_contents) + self.assertTrue("#. Translators: Django comment block for translators\n#. string's meaning unveiled" in po_contents) + + self.assertTrue('#. Translators: One-line translator comment #1' in po_contents) + self.assertTrue('#. Translators: Two-line translator comment #1\n#. continued here.' in po_contents) + + self.assertTrue('#. Translators: One-line translator comment #2' in po_contents) + self.assertTrue('#. Translators: Two-line translator comment #2\n#. continued here.' in po_contents) + + self.assertTrue('#. Translators: One-line translator comment #3' in po_contents) + self.assertTrue('#. Translators: Two-line translator comment #3\n#. continued here.' in po_contents) + + self.assertTrue('#. Translators: One-line translator comment #4' in po_contents) + self.assertTrue('#. Translators: Two-line translator comment #4\n#. continued here.' in po_contents) def test_templatize(self): os.chdir(self.test_dir) diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html index ff8485ead5..86c7772580 100644 --- a/tests/regressiontests/i18n/commands/templates/test.html +++ b/tests/regressiontests/i18n/commands/templates/test.html @@ -1,8 +1,52 @@ {% load i18n %} -{% comment %}Translators: Django comment block for translators {% endcomment %} +{% comment %}Translators: Django comment block for translators +string's meaning unveiled +{% endcomment %} {% trans "This literal should be included." %} {% trans "This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option." %} {# Translators: Django template comment for translators #} <p>{% blocktrans %}I think that 100% is more that 50% of anything.{% endblocktrans %}</p> {% blocktrans with 'txt' as obj %}I think that 100% is more that 50% of {{ obj }}.{% endblocktrans %} + +{% comment %}Some random comment +Some random comment +Translators: One-line translator comment #1 +{% endcomment %} +{% trans "Translatable literal #1a" %} + +{% comment %}Some random comment +Some random comment +Translators: Two-line translator comment #1 +continued here. +{% endcomment %} +{% trans "Translatable literal #1b" %} + +{% comment %}Some random comment +Translators: One-line translator comment #2 +{% endcomment %} +{% trans "Translatable literal #2a" %} + +{% comment %}Some random comment +Translators: Two-line translator comment #2 +continued here. +{% endcomment %} +{% trans "Translatable literal #2b" %} + +{% comment %} + Translators: One-line translator comment #3 +{% endcomment %} +{% trans "Translatable literal #3a" %} + +{% comment %} +Translators: Two-line translator comment #3 +continued here. +{% endcomment %} +{% trans "Translatable literal #3b" %} + +{% comment %} Translators: One-line translator comment #4{% endcomment %} +{% trans "Translatable literal #4a" %} + +{% comment %} Translators: Two-line translator comment #4 +continued here.{% endcomment %} +{% trans "Translatable literal #4b" %} |
