From 2757209c9de3764364a8e8af39cefa2445312546 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 6 Feb 2017 09:15:25 +0100 Subject: [PATCH] Refs #27795 -- Removed force_text from templatize function --- django/core/management/commands/makemessages.py | 2 +- django/utils/translation/template.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index 029d5163a5..fd2cb7eaa6 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -110,7 +110,7 @@ class BuildFile: if self.domain == 'djangojs': content = prepare_js_for_gettext(src_data) elif self.domain == 'django': - content = templatize(src_data, origin=self.path[2:], charset=encoding) + content = templatize(src_data, origin=self.path[2:]) with open(self.work_path, 'w', encoding='utf-8') as fp: fp.write(content) diff --git a/django/utils/translation/template.py b/django/utils/translation/template.py index c471dd489f..3659fab3b6 100644 --- a/django/utils/translation/template.py +++ b/django/utils/translation/template.py @@ -6,7 +6,6 @@ from django.template.base import ( TOKEN_BLOCK, TOKEN_COMMENT, TOKEN_TEXT, TOKEN_VAR, TRANSLATOR_COMMENT_MARK, Lexer, ) -from django.utils.encoding import force_text from . import TranslatorCommentWarning, trim_whitespace @@ -36,13 +35,12 @@ plural_re = re.compile(r"""^\s*plural$""") constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") -def templatize(src, origin=None, charset='utf-8'): +def templatize(src, origin=None): """ Turn a Django template into something that is understood by xgettext. It does so by translating the Django translation tags into standard gettext function invocations. """ - src = force_text(src, charset) out = StringIO('') message_context = None intrans = False