X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=i18n.py;h=807aedda6b6d92444df48dabe63498a2cef1e4d4;hb=f4ad61cc3b3192f47c492b3916a0afb27c9b11dd;hp=8e2fd6404e5d4d031c92fc31f72727b1ba95fad0;hpb=7b3f53a88e86154587269826064aa4c0a067f253;p=dcpomatic.git diff --git a/i18n.py b/i18n.py index 8e2fd6404..807aedda6 100644 --- a/i18n.py +++ b/i18n.py @@ -2,6 +2,10 @@ import glob import os from waflib import Logs +def command(c): + print c + os.system(c) + def pot(dir, sources, name): s = "" for f in sources.split('\n'): @@ -16,8 +20,11 @@ def pot(dir, sources, name): except: pass - os.system('xgettext -d %s -s --keyword=_ --add-comments=/ -p %s -o %s.pot %s' % (name, d, name, s)) - + command('xgettext -d %s -s --keyword=_ --add-comments=/ -p %s -o %s.pot %s' % (name, d, name, s)) + +def pot_merge(dir, name): + for f in glob.glob(os.path.join(os.getcwd(), dir, 'po', '*.po')): + command('msgmerge %s %s.pot -o %s' % (f, os.path.join('build', dir, name), f)) def po_to_mo(dir, name, bld): for f in glob.glob(os.path.join(os.getcwd(), dir, 'po', '*.po')): @@ -25,5 +32,5 @@ def po_to_mo(dir, name, bld): po = os.path.join('po', '%s.po' % lang) mo = os.path.join('mo', lang, '%s.mo' % name) - bld(rule = 'msgfmt ${SRC} -o ${TGT}', source = bld.path.make_node(po), target = bld.path.get_bld().make_node(mo)) + bld(rule = 'msgfmt -f ${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)