diff --git a/django/bin/compile-messages.py b/django/bin/compile-messages.py new file mode 100755 index 0000000000..0b5127f6b2 --- /dev/null +++ b/django/bin/compile-messages.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import os +import sys +import getopt + +basedir = None + +if os.path.isdir(os.path.join('conf', 'locale')): + basedir = os.path.abspath(os.path.join('conf', 'locale')) +elif os.path.isdir('locale'): + basedir = os.path.abspath('locale') +else: + print "this script should be run from the django svn tree or your project or app tree" + sys.exit(1) + +for (dirpath, dirnames, filenames) in os.walk(basedir): + for file in filenames: + if file.endswith('.po'): + sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) + pf = os.path.splitext(os.path.join(dirpath, file))[0] + cmd = 'msgfmt -o %s.mo %s.po' % (pf, pf) + os.system(cmd) + diff --git a/django/bin/make-messages.py b/django/bin/make-messages.py new file mode 100755 index 0000000000..e068382292 --- /dev/null +++ b/django/bin/make-messages.py @@ -0,0 +1,47 @@ +#!/usr/bin/python + +import os +import sys +import getopt + +basedir = None + +if os.path.isdir(os.path.join('conf', 'locale')): + basedir = os.path.abspath(os.path.join('conf', 'locale')) +elif os.path.isdir('locale'): + basedir = os.path.abspath('locale') +else: + print "this script should be run from the django svn tree or your project or app tree" + sys.exit(1) + +(opts, args) = getopt.getopt(sys.argv[1:], 'l:d:') + +lang = None +domain = 'django' + +for o, v in opts: + if o == '-l': + lang = v + elif o == '-d': + domain = v + +if lang is None or domain is None: + print "usage: make-messages.py -l -d " + sys.exit(1) + +basedir = os.path.join(basedir, lang, 'LC_MESSAGES') +if not os.path.isdir(basedir): + os.makedirs(basedir) + +lf = os.path.join(basedir, '%s.po' % domain) + +for (dirpath, dirnames, filenames) in os.walk("."): + for file in filenames: + if file.endswith('.py') or file.endswith('.html'): + sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) + if os.path.isfile(lf): + cmd = 'xgettext -j -d %s -L Python -p %s %s' % (domain, basedir, os.path.join(dirpath, file)) + else: + cmd = 'xgettext -d %s -L Python -p %s %s' % (domain, basedir, os.path.join(dirpath, file)) + os.system(cmd) + diff --git a/django/conf/admin_templates/index.html b/django/conf/admin_templates/index.html index 7610b3a023..1a6949cf6c 100644 --- a/django/conf/admin_templates/index.html +++ b/django/conf/admin_templates/index.html @@ -23,13 +23,13 @@ {% endif %} {% if model.perms.add %} - Add + {% i18n _('Add') %} {% else %}   {% endif %} {% if model.perms.change %} - Change + {% i18n _('Change') %} {% else %}   {% endif %} @@ -47,12 +47,12 @@ {% block sidebar %}