Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 84208dd5da
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (31 sloc) 1.019 kb
# Language extension for distutils Python scripts. Based on this concept:
from distutils import cmd
from import build as _build
import os
class build_trans(cmd.Command):
description = 'Compile .po files into .mo files'
def initialize_options(self):
def finalize_options(self):
def run(self):
s = os.path.join('plugin', 'locale')
for lang in os.listdir(s):
lc = os.path.join(s, lang, 'LC_MESSAGES')
if os.path.isdir(lc):
for f in os.listdir(lc):
if f.endswith('.po'):
src = os.path.join(lc, f)
dest = os.path.join(lc, f[:-2] + 'mo')
print "Language compile %s -> %s" % (src, dest)
if os.system("msgfmt '%s' -o '%s'" % (src, dest)) != 0:
raise Exception, "Failed to compile: " + src
class build(_build):
sub_commands = _build.sub_commands + [('build_trans', None)]
def run(self):
cmdclass = {
'build': build,
'build_trans': build_trans,
Jump to Line
Something went wrong with that request. Please try again.