Kaydet (Commit) 28fd3231 authored tarafından Adrian Holovaty's avatar Adrian Holovaty

Updated django.utils.translation due to template changes from [1379]. From new-admin.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1388 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst eab4a225
...@@ -364,18 +364,18 @@ endblock_re = re.compile(r"""^\s*endblocktrans$""") ...@@ -364,18 +364,18 @@ endblock_re = re.compile(r"""^\s*endblocktrans$""")
plural_re = re.compile(r"""^\s*plural$""") plural_re = re.compile(r"""^\s*plural$""")
constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""") constant_re = re.compile(r"""_\(((?:".*?")|(?:'.*?'))\)""")
def templateize(src): def templateize(src):
from django.core.template import tokenize, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
""" """
Turns a Django template into something that is understood by xgettext. It Turns 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.
""" """
from django.core.template import Lexer, TOKEN_TEXT, TOKEN_VAR, TOKEN_BLOCK
out = StringIO() out = StringIO()
intrans = False intrans = False
inplural = False inplural = False
singular = [] singular = []
plural = [] plural = []
for t in tokenize(src): for t in Lexer(src, None).tokenize():
if intrans: if intrans:
if t.token_type == TOKEN_BLOCK: if t.token_type == TOKEN_BLOCK:
endbmatch = endblock_re.match(t.contents) endbmatch = endblock_re.match(t.contents)
......
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