diff options
| author | Jeremy Dunck <jdunck@gmail.com> | 2007-03-23 16:35:57 +0000 |
|---|---|---|
| committer | Jeremy Dunck <jdunck@gmail.com> | 2007-03-23 16:35:57 +0000 |
| commit | fa3ed6e1341f7c8b468e2267b3fafddeb58cdac2 (patch) | |
| tree | 6d8bf65854f8431355e2d91cbc61a37ab6f23d9a /django/bin | |
| parent | 8b279b63bef5c1348cc27c50633fc2d5ef09d7c1 (diff) | |
gis: Merged revisions 4669-4785 via svnmerge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@4786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/bin')
| -rwxr-xr-x | django/bin/compile-messages.py | 17 | ||||
| -rwxr-xr-x | django/bin/make-messages.py | 4 |
2 files changed, 17 insertions, 4 deletions
diff --git a/django/bin/compile-messages.py b/django/bin/compile-messages.py index 0137ec8dd4..f2193d3122 100755 --- a/django/bin/compile-messages.py +++ b/django/bin/compile-messages.py @@ -1,9 +1,10 @@ #!/usr/bin/env python +import optparse import os import sys -def compile_messages(): +def compile_messages(locale=None): basedir = None if os.path.isdir(os.path.join('conf', 'locale')): @@ -14,6 +15,9 @@ def compile_messages(): print "This script should be run from the Django SVN tree or your project or app tree." sys.exit(1) + if locale is not None: + basedir = os.path.join(basedir, locale, 'LC_MESSAGES') + for dirpath, dirnames, filenames in os.walk(basedir): for f in filenames: if f.endswith('.po'): @@ -32,5 +36,14 @@ def compile_messages(): cmd = 'msgfmt -o "$djangocompilemo" "$djangocompilepo"' os.system(cmd) +def main(): + parser = optparse.OptionParser() + parser.add_option('-l', '--locale', dest='locale', + help="The locale to process. Default is to process all.") + options, args = parser.parse_args() + if len(args): + parser.error("This program takes no arguments") + compile_messages(options.locale) + if __name__ == "__main__": - compile_messages() + main() diff --git a/django/bin/make-messages.py b/django/bin/make-messages.py index 557cb5eeec..34fb68dcfe 100755 --- a/django/bin/make-messages.py +++ b/django/bin/make-messages.py @@ -81,7 +81,7 @@ def make_messages(): src = pythonize_re.sub('\n#', src) open(os.path.join(dirpath, '%s.py' % file), "wb").write(src) thefile = '%s.py' % file - cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy -o - "%s"' % ( + cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy --from-code UTF-8 -o - "%s"' % ( os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) (stdin, stdout, stderr) = os.popen3(cmd, 'b') msgs = stdout.read() @@ -103,7 +103,7 @@ def make_messages(): open(os.path.join(dirpath, '%s.py' % file), "wb").write(templatize(src)) thefile = '%s.py' % file 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 --from-code UTF-8 -o - "%s"' % ( os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) (stdin, stdout, stderr) = os.popen3(cmd, 'b') msgs = stdout.read() |
