diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 675fb3f..5839e74 100644
a
|
b
|
def templatize(src, origin=None):
|
435 | 435 | does so by translating the Django translation tags into standard gettext |
436 | 436 | function invocations. |
437 | 437 | """ |
438 | | from django.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK, TOKEN_COMMENT |
| 438 | from django.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK, TOKEN_COMMENT, TRANSLATOR_COMMENT_MARK |
439 | 439 | out = StringIO() |
440 | 440 | intrans = False |
441 | 441 | inplural = False |
… |
… |
def templatize(src, origin=None):
|
446 | 446 | for t in Lexer(src, origin).tokenize(): |
447 | 447 | if incomment: |
448 | 448 | if t.token_type == TOKEN_BLOCK and t.contents == 'endcomment': |
449 | | out.write(' # %s' % ''.join(comment)) |
| 449 | content = u''.join(comment).lstrip() |
| 450 | if content.startswith(TRANSLATOR_COMMENT_MARK): |
| 451 | for line in content.splitlines(True): |
| 452 | out.write(u' # %s' % line) |
450 | 453 | incomment = False |
451 | 454 | comment = [] |
452 | 455 | else: |
diff --git a/tests/regressiontests/i18n/commands/extraction.py b/tests/regressiontests/i18n/commands/extraction.py
index 1f36b8a..c7b25d2 100644
a
|
b
|
class BasicExtractorTests(ExtractorTests):
|
49 | 49 | self.assertTrue('This comment should not be extracted' not in po_contents) |
50 | 50 | # Comments in templates |
51 | 51 | self.assertTrue('#. Translators: Django template comment for translators' in po_contents) |
52 | | self.assertTrue('#. Translators: Django comment block for translators' in po_contents) |
| 52 | self.assertTrue("#. Translators: Django comment block for translators\n#. string's meaning unveiled" in po_contents) |
53 | 53 | |
54 | 54 | def test_templatize(self): |
55 | 55 | os.chdir(self.test_dir) |
diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html
index ff8485e..cbe0752 100644
a
|
b
|
|
1 | 1 | {% load i18n %} |
2 | | {% comment %}Translators: Django comment block for translators {% endcomment %} |
| 2 | {% comment %}Translators: Django comment block for translators |
| 3 | string's meaning unveiled |
| 4 | {% endcomment %} |
3 | 5 | {% trans "This literal should be included." %} |
4 | 6 | {% trans "This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option." %} |
5 | 7 | |