Target pot_merge to merge new .pot files with existing .po; update translations accor...
[dcpomatic.git] / i18n.py
diff --git a/i18n.py b/i18n.py
index 8e2fd6404e5d4d031c92fc31f72727b1ba95fad0..ce28d25e99d1e6d359132a8fcba6ebeabbf1a78a 100644 (file)
--- 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')):