Try to centralise .pot building.
authorCarl Hetherington <cth@carlh.net>
Sat, 23 Feb 2013 00:12:11 +0000 (00:12 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 23 Feb 2013 00:12:11 +0000 (00:12 +0000)
i18n.py
src/lib/wscript
src/tools/wscript
src/wx/wscript

diff --git a/i18n.py b/i18n.py
index d5531834b29c34b00686314cd5b2c0ccc7a897ba..10eaa38e900578536d92bded978853d8efb6be58 100644 (file)
--- a/i18n.py
+++ b/i18n.py
@@ -2,6 +2,17 @@ import glob
 import os
 from waflib import Logs
 
+def pot(dir, sources, name):
+    s = ""
+    for f in sources.split('\n'):
+        t = f.strip()
+        if len(t) > 0:
+            s += (os.path.join(dir, t)) + " "
+
+    Logs.info('Making %s.pot' % os.path.join('build', dir, name))
+    os.system('xgettext -d %s -s --keyword=_ -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')):
         
index ee89ad0856525ba4d07ed32886df4138efc66048..59047c70dd0ca75a88007a520425412f50c4f130 100644 (file)
@@ -1,4 +1,5 @@
 import os
+import i18n
 
 sources = """
           ab_transcode_job.cc
@@ -68,10 +69,4 @@ def build(bld):
     obj.target = 'dvdomatic'
 
 def pot(bld):
-    s = ""
-    for f in sources.split('\n'):
-        t = f.strip()
-        if len(t) > 0:
-            s += (os.path.join('src', 'lib', t)) + " "
-
-    os.system('xgettext -d libdvdomatic -s --keyword=_ -p build/src/lib -o libdvdomatic.pot %s' % s)
+    i18n.pot(os.path.join('src', 'lib'), sources, 'libdvdomatic')
index 8af3d06a5fd3bd254311c03cce540525b0d2fa20..de130ce17fedbde2d89e02387358e3e284575ac8 100644 (file)
@@ -24,7 +24,7 @@ def build(bld):
             obj.target = t
 
 def pot(bld):
-    os.system('xgettext -d dvdomatic -s --keyword=_ -p build/src/tools -o dvdomatic.pot %s' % os.path.join('src', 'tools', 'dvdomatic.cc'))
+    i18n.pot(os.path.join('src', 'tools'), 'dvdomatic.cc', 'dvdomatic')
 
 def mo(bld):
     i18n.po_to_mo(os.path.join('src', 'tools'), 'dvdomatic')
index 95cdbc8f02b5b779f83f8fb3dbaf7cb31111750c..a0a4bbe8b27e85f3d9d166143e1bbd26ba1b2641 100644 (file)
@@ -39,13 +39,7 @@ def build(bld):
     obj.target = 'dvdomatic-wx'
 
 def pot(bld):
-    s = ""
-    for f in sources.split('\n'):
-        t = f.strip()
-        if len(t) > 0:
-            s += (os.path.join('src', 'wx', t)) + " "
-
-    os.system('xgettext -d libdvdomatic-wx -s --keyword=_ -p build/src/wx -o libdvdomatic-wx.pot %s' % s)
+    i18n.pot(os.path.join('src', 'wx'), sources, 'libdvdomatic-wx')
 
 def mo(bld):
     i18n.po_to_mo(os.path.join('src', 'wx'), 'libdvdomatic-wx')