diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-06-07 16:11:25 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-06-07 16:11:25 +0000 |
| commit | 64e19ffb4ee32767861d25c874f0d2dfc75618b7 (patch) | |
| tree | 11d0e86691bcb8917822d3d2a8abee6972642585 /django/core | |
| parent | d14eb13992e782b2dfa7f2633b38a87e34efd45e (diff) | |
Fixed #7704, #14045 and #15495 -- Introduce a lexer for Javascript to fix multiple problems of the translation of Javascript files with xgettext. Many thanks to Ned Batchelder for his contribution of the JsLex library.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16333 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management/commands/makemessages.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index a244a60de5..899775d020 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -9,8 +9,8 @@ from subprocess import PIPE, Popen from django.core.management.base import CommandError, NoArgsCommand from django.utils.text import get_text_list +from django.utils.jslex import prepare_js_for_gettext -pythonize_re = re.compile(r'(?:^|\n)\s*//') plural_forms_re = re.compile(r'^(?P<value>"Plural-Forms.+?\\n")\s*$', re.MULTILINE | re.DOTALL) def handle_extensions(extensions=('html',)): @@ -184,15 +184,15 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False, if verbosity > 1: sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) src = open(os.path.join(dirpath, file), "rU").read() - src = pythonize_re.sub('\n#', src) - thefile = '%s.py' % file + src = prepare_js_for_gettext(src) + thefile = '%s.c' % file f = open(os.path.join(dirpath, thefile), "w") try: f.write(src) finally: f.close() cmd = ( - 'xgettext -d %s -L Perl %s --keyword=gettext_noop ' + 'xgettext -d %s -L C %s --keyword=gettext_noop ' '--keyword=gettext_lazy --keyword=ngettext_lazy:1,2 ' '--keyword=pgettext:1c,2 --keyword=npgettext:1c,2,3 ' '--from-code UTF-8 --add-comments=Translators -o - "%s"' % ( |
