Ticket #6624: django-make-messages-improve.diff
File django-make-messages-improve.diff, 1.6 KB (added by , 17 years ago) |
---|
-
django/bin/make-messages.py
13 13 14 14 pythonize_re = re.compile(r'\n\s*//') 15 15 16 def _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 16 20 def make_messages(): 17 21 localedir = None 18 22 … … 29 33 print "you want to enable i18n for your project or application." 30 34 sys.exit(1) 31 35 32 (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va ')36 (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:vah') 33 37 34 38 lang = None 35 39 domain = 'django' … … 45 49 verbose = True 46 50 elif o == '-a': 47 51 all = True 52 elif o == '-h': 53 _print_usage() 54 sys.exit(0) 48 55 49 56 if domain not in ('django', 'djangojs'): 50 57 print "currently make-messages.py only supports domains 'django' and 'djangojs'" 51 58 sys.exit(1) 52 59 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() 55 61 sys.exit(1) 56 62 57 63 languages = [] … … 62 68 languages = [el for el in os.listdir(localedir) if not el.startswith('.')] 63 69 64 70 for lang in languages: 65 66 71 print "processing language", lang 67 72 basedir = os.path.join(localedir, lang, 'LC_MESSAGES') 68 73 if not os.path.isdir(basedir):