Refs #27795 -- Removed force_text from templatize function

This commit is contained in:
Claude Paroz 2017-02-06 09:15:25 +01:00
parent 15c14f6f16
commit 2757209c9d
2 changed files with 2 additions and 4 deletions

View File

@ -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)

View File

@ -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