Kaydet (Commit) 2757209c authored tarafından Claude Paroz's avatar Claude Paroz

Refs #27795 -- Removed force_text from templatize function

üst 15c14f6f
...@@ -110,7 +110,7 @@ class BuildFile: ...@@ -110,7 +110,7 @@ class BuildFile:
if self.domain == 'djangojs': if self.domain == 'djangojs':
content = prepare_js_for_gettext(src_data) content = prepare_js_for_gettext(src_data)
elif self.domain == 'django': 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: with open(self.work_path, 'w', encoding='utf-8') as fp:
fp.write(content) fp.write(content)
......
...@@ -6,7 +6,6 @@ from django.template.base import ( ...@@ -6,7 +6,6 @@ from django.template.base import (
TOKEN_BLOCK, TOKEN_COMMENT, TOKEN_TEXT, TOKEN_VAR, TRANSLATOR_COMMENT_MARK, TOKEN_BLOCK, TOKEN_COMMENT, TOKEN_TEXT, TOKEN_VAR, TRANSLATOR_COMMENT_MARK,
Lexer, Lexer,
) )
from django.utils.encoding import force_text
from . import TranslatorCommentWarning, trim_whitespace from . import TranslatorCommentWarning, trim_whitespace
...@@ -36,13 +35,12 @@ plural_re = re.compile(r"""^\s*plural$""") ...@@ -36,13 +35,12 @@ plural_re = re.compile(r"""^\s*plural$""")
constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") 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 Turn a Django template into something that is understood by xgettext. It
does so by translating the Django translation tags into standard gettext does so by translating the Django translation tags into standard gettext
function invocations. function invocations.
""" """
src = force_text(src, charset)
out = StringIO('') out = StringIO('')
message_context = None message_context = None
intrans = False intrans = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment