diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-02-28 23:16:13 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-02-28 23:16:13 +0000 |
| commit | 3940c9ceea90f99d18792bb9ea6074ca65d7fed9 (patch) | |
| tree | 03d827e8f840f8c20d09fbb068bc5d1882c4c84c /i18n.py | |
| parent | 0d3f5aae5b99832b7c5d55f32f5bccb365caa3fd (diff) | |
Build and install mo files from po.
Diffstat (limited to 'i18n.py')
| -rw-r--r-- | i18n.py | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -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) |
