diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-04-18 20:00:10 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-04-18 20:00:10 +0000 |
| commit | 0defa7dc9dc97a11baea3b91158fbc7c57e5c3a6 (patch) | |
| tree | bcf85cf329bd7a59949b973b7e7cccd8051ff3eb | |
| parent | d3e5380b41c1237e138c9432c8eb7d6ff91fe9ac (diff) | |
Fixed #15848 -- Fixed regression introduced in [15882] in makemessages management command when processing multi-line comments that contain non-ASCCI characters in templates. Thanks for the report Denis Drescher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16038 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/utils/translation/trans_real.py | 6 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/commands/templates/test.html | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index d8bb6a6e29..b497d9e354 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -435,16 +435,16 @@ def templatize(src, origin=None): for t in Lexer(src, origin).tokenize(): if incomment: if t.token_type == TOKEN_BLOCK and t.contents == 'endcomment': - content = u''.join(comment) + content = ''.join(comment) translators_comment_start = None for lineno, line in enumerate(content.splitlines(True)): if line.lstrip().startswith(TRANSLATOR_COMMENT_MARK): translators_comment_start = lineno for lineno, line in enumerate(content.splitlines(True)): if translators_comment_start is not None and lineno >= translators_comment_start: - out.write(u' # %s' % line) + out.write(' # %s' % line) else: - out.write(u' #\n') + out.write(' #\n') incomment = False comment = [] else: diff --git a/tests/regressiontests/i18n/commands/templates/test.html b/tests/regressiontests/i18n/commands/templates/test.html index 86c7772580..b5d705c132 100644 --- a/tests/regressiontests/i18n/commands/templates/test.html +++ b/tests/regressiontests/i18n/commands/templates/test.html @@ -50,3 +50,10 @@ continued here. {% comment %} Translators: Two-line translator comment #4 continued here.{% endcomment %} {% trans "Translatable literal #4b" %} + +{% comment %} Translators: One-line translator comment #5 -- with non ASCII characters: áéíóúö{% endcomment %} +{% trans "Translatable literal #5a" %} + +{% comment %} Translators: Two-line translator comment #5 -- with non ASCII characters: áéíóúö +continued here.{% endcomment %} +{% trans "Translatable literal #6b" %} |
