Ticket #6624: django-make-messages-improve.diff

File django-make-messages-improve.diff, 1.6 KB (added by Ludvig Ericson, 17 years ago)
  • django/bin/make-messages.py

     
    1313
    1414pythonize_re = re.compile(r'\n\s*//')
    1515
     16def _print_usage():
     17    print "usage: %s -l <language>\tupdate locale for language" % (sys.argv[0],)
     18    print "   or: %s -a           \tupdate all locales" % (sys.argv[0],)
     19
    1620def make_messages():
    1721    localedir = None
    1822
     
    2933        print "you want to enable i18n for your project or application."
    3034        sys.exit(1)
    3135
    32     (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va')
     36    (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:vah')
    3337
    3438    lang = None
    3539    domain = 'django'
     
    4549            verbose = True
    4650        elif o == '-a':
    4751            all = True
     52        elif o == '-h':
     53            _print_usage()
     54            sys.exit(0)
    4855
    4956    if domain not in ('django', 'djangojs'):
    5057        print "currently make-messages.py only supports domains 'django' and 'djangojs'"
    5158        sys.exit(1)
    5259    if (lang is None and not all) or domain is None:
    53         print "usage: make-messages.py -l <language>"
    54         print "   or: make-messages.py -a"
     60        _print_usage()
    5561        sys.exit(1)
    5662
    5763    languages = []
     
    6268        languages = [el for el in os.listdir(localedir) if not el.startswith('.')]
    6369
    6470    for lang in languages:
    65 
    6671        print "processing language", lang
    6772        basedir = os.path.join(localedir, lang, 'LC_MESSAGES')
    6873        if not os.path.isdir(basedir):
Back to Top