Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #3679 -- Added an option to compile localisation messages for a…

… single

locale.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4687 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fcd119bfb18b20e81457f845b826733eee9c0cd0 1 parent 20a240c
@malcolmt malcolmt authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 django/bin/compile-messages.py
View
17 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()
Please sign in to comment.
Something went wrong with that request. Please try again.