summaryrefslogtreecommitdiff
path: root/i18n.py
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-28 23:16:13 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-28 23:16:13 +0000
commit3940c9ceea90f99d18792bb9ea6074ca65d7fed9 (patch)
tree03d827e8f840f8c20d09fbb068bc5d1882c4c84c /i18n.py
parent0d3f5aae5b99832b7c5d55f32f5bccb365caa3fd (diff)
Build and install mo files from po.
Diffstat (limited to 'i18n.py')
-rw-r--r--i18n.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/i18n.py b/i18n.py
index c22cbdb95..ab7f6843b 100644
--- a/i18n.py
+++ b/i18n.py
@@ -17,15 +17,11 @@ def pot(dir, sources, name, all = False):
os.system('xgettext -d %s -s --keyword=_ --add-comments=/ -p %s -o %s.pot %s' % (name, os.path.join('build', dir), name, s))
-def po_to_mo(dir, name):
- for f in glob.glob(os.path.join(dir, 'po', '*.po')):
-
+def po_to_mo(dir, name, bld):
+ for f in glob.glob(os.path.join(os.getcwd(), dir, 'po', '*.po')):
lang = os.path.basename(f).replace('.po', '')
- out = os.path.join('build', dir, 'mo', lang, '%s.mo' % name)
- try:
- os.makedirs(os.path.dirname(out))
- except:
- pass
+ po = os.path.join('po', '%s.po' % lang)
+ mo = os.path.join('mo', lang, '%s.mo' % name)
- os.system('msgfmt %s -o %s' % (f, out))
- Logs.info('%s -> %s' % (f, out))
+ bld(rule = 'msgfmt ${SRC} -o ${TGT}', source = bld.path.make_node(po), target = bld.path.get_bld().make_node(mo))
+ bld.install_files(os.path.join('${PREFIX}', 'share', 'locale', lang, 'LC_MESSAGES'), mo)