summaryrefslogtreecommitdiff
path: root/autowaf.py
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-11-10 22:46:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-11-10 22:46:38 +0000
commit71df3719d4b77f63596ffb5b478bf9d2aa2edf97 (patch)
tree25c393ac56fbfdceefaac7ce1ae9c2c78adfea88 /autowaf.py
parentb8da7d196c23a1ad153af7b00e641f5c2573f2c0 (diff)
re-enable i18n as a build target for translations
git-svn-id: svn://localhost/ardour2/branches/3.0@7995 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'autowaf.py')
-rw-r--r--autowaf.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/autowaf.py b/autowaf.py
index 413a5fa24f..188965c0c1 100644
--- a/autowaf.py
+++ b/autowaf.py
@@ -11,6 +11,8 @@ import misc
import os
import subprocess
import sys
+import glob
+
from TaskGen import feature, before, after
global g_is_child
@@ -436,3 +438,40 @@ def shutdown():
try: os.popen("/sbin/ldconfig")
except: pass
+def build_i18n(bld,srcdir,dir,name,sources):
+ pwd = bld.get_curdir()
+ os.chdir(os.path.join (srcdir, dir))
+
+ pot_file = '%s.pot' % name
+
+ args = [ 'xgettext',
+ '--keyword=_',
+ '--keyword=N_',
+ '--from-code=UTF-8',
+ '-o', pot_file,
+ '--copyright-holder="Paul Davis"' ]
+ args += sources
+ print 'Updating ', pot_file
+ os.spawnvp (os.P_WAIT, 'xgettext', args)
+
+ po_files = glob.glob ('po/*.po')
+ languages = [ po.replace ('.po', '') for po in po_files ]
+
+ for po_file in po_files:
+ args = [ 'msgmerge',
+ '--update',
+ po_file,
+ pot_file ]
+ print 'Updating ', po_file
+ os.spawnvp (os.P_WAIT, 'msgmerge', args)
+
+ for po_file in po_files:
+ mo_file = po_file.replace ('.po', '.mo')
+ args = [ 'msgfmt',
+ '-c',
+ '-o',
+ mo_file,
+ po_file ]
+ print 'Generating ', po_file
+ os.spawnvp (os.P_WAIT, 'msgfmt', args)
+ os.chdir (pwd)