Ticket #1182: make-messages-exclude-apps.diff

File make-messages-exclude-apps.diff, 1.6 KB (added by akaihola, 10 years ago)
  • django_src/django/bin/make-messages.py

     
    2424    print "you want to enable i18n for your project or application."
    2525    sys.exit(1)
    2626
    27 (opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va')
     27(opts, args) = getopt.getopt(sys.argv[1:], 'l:d:vap')
    2828
    2929lang = None
    3030domain = 'django'
    3131verbose = False
    3232all = False
     33include_apps = False
    3334
    3435for o, v in opts:
    3536    if o == '-l':
     
    4041        verbose = True
    4142    elif o == '-a':
    4243        all = True
     44    elif o == '-p':
     45        include_apps = True
    4346
    4447if domain not in ('django', 'djangojs'):
    4548    print "currently make-messages.py only supports domains 'django' and 'djangojs'"
    4649    sys.exit(1)
    4750if (lang is None and not all) or domain is None:
    48     print "usage: make-messages.py -l <language>"
    49     print "   or: make-messages.py -a"
     51    print "usage: make-messages.py -l <language> [-d <domain>] [-v] [-p]"
     52    print "   or: make-messages.py -a [-d <domain>] [-v] [-p]"
     53    print "-v enables verbose output"
     54    print "-p includes the ./apps tree (excluded by default)"
    5055    sys.exit(1)
    5156
    5257languages = []
     
    117122                if thefile != file:
    118123                    os.unlink(os.path.join(dirpath, thefile))
    119124
     125        if not include_apps and dirpath == '.':
     126            try: dirnames.remove('apps')
     127            except ValueError: pass
     128           
    120129    if os.path.exists(potfile):
    121130        (stdin, stdout, stderr) = os.popen3('msguniq %s' % potfile, 'b')
    122131        msgs = stdout.read()
Back to Top