Negligible refactoring in django.core.meta.fields and django.contrib.admin.views...
[fdr-django.git] / django / bin / compile-messages.py
blob0b5127f6b20c1d40042091277fa8af6af22d32f7
1 #!/usr/bin/python
3 import os
4 import sys
5 import getopt
7 basedir = None
9 if os.path.isdir(os.path.join('conf', 'locale')):
10 basedir = os.path.abspath(os.path.join('conf', 'locale'))
11 elif os.path.isdir('locale'):
12 basedir = os.path.abspath('locale')
13 else:
14 print "this script should be run from the django svn tree or your project or app tree"
15 sys.exit(1)
17 for (dirpath, dirnames, filenames) in os.walk(basedir):
18 for file in filenames:
19 if file.endswith('.po'):
20 sys.stderr.write('processing file %s in %s\n' % (file, dirpath))
21 pf = os.path.splitext(os.path.join(dirpath, file))[0]
22 cmd = 'msgfmt -o %s.mo %s.po' % (pf, pf)
23 os.system(cmd)