Fixed #1244 -- Renamed templateize to templatize in django.utils.translation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
23d2be1714
commit
e35655081f
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
from django.utils.translation import templateize
|
from django.utils.translation import templatize
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -96,7 +96,7 @@ def make_messages():
|
||||||
thefile = file
|
thefile = file
|
||||||
if file.endswith('.html'):
|
if file.endswith('.html'):
|
||||||
src = open(os.path.join(dirpath, file), "rb").read()
|
src = open(os.path.join(dirpath, file), "rb").read()
|
||||||
open(os.path.join(dirpath, '%s.py' % file), "wb").write(templateize(src))
|
open(os.path.join(dirpath, '%s.py' % file), "wb").write(templatize(src))
|
||||||
thefile = '%s.py' % file
|
thefile = '%s.py' % file
|
||||||
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
|
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
|
||||||
cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy -o - "%s"' % (
|
cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy -o - "%s"' % (
|
||||||
|
|
|
@ -369,7 +369,7 @@ dot_re = re.compile(r'\S')
|
||||||
def blankout(src, char):
|
def blankout(src, char):
|
||||||
"""
|
"""
|
||||||
Changes every non-whitespace character to the given char.
|
Changes every non-whitespace character to the given char.
|
||||||
Used in the templateize function.
|
Used in the templatize function.
|
||||||
"""
|
"""
|
||||||
return dot_re.sub(char, src)
|
return dot_re.sub(char, src)
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ block_re = re.compile(r"""^\s*blocktrans(?:\s+|$)""")
|
||||||
endblock_re = re.compile(r"""^\s*endblocktrans$""")
|
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 templatize(src):
|
||||||
"""
|
"""
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue