re-enable i18n as a build target for translations
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Nov 2010 22:46:38 +0000 (22:46 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Nov 2010 22:46:38 +0000 (22:46 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7995 d708f5d6-7413-0410-9779-e7cbd77b26cf

autowaf.py
gtk2_ardour/wscript
libs/ardour/wscript
wscript

index 413a5fa24f529acf3466e66c625076baee3551aa..188965c0c163b461127711fd70aa05cb557d3952 100644 (file)
@@ -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)
index 7d3f74f024fbb2953ab3a46e8850aa12cc81af2e..52a28f286f867dfb453b45fc63c5dbdaf829dc53 100644 (file)
@@ -478,5 +478,5 @@ def build(bld):
                        bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
 
 def i18n(bld):
-       autowaf.build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)
+       autowaf.build_i18n (bld, srcdir, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)
 
index 14811eed50795f526175bc6449c4cd0b3093aba4..b8d49febb9e70b3bff00482fe85b04fad3770b8e 100644 (file)
@@ -372,4 +372,4 @@ def shutdown():
        autowaf.shutdown()
 
 def i18n(bld):
-       autowaf.build_i18n (bld, 'libs/ardour', APPNAME, libardour_sources)
+       autowaf.build_i18n (bld, '..', 'libs/ardour', APPNAME, libardour_sources)
diff --git a/wscript b/wscript
index 69b531f93bcb80268591d5507eabbc2bf214a020..edd4b2dbc3afee865846fd69229e6e08ddc076b1 100644 (file)
--- a/wscript
+++ b/wscript
@@ -6,6 +6,7 @@ import re
 import string
 import subprocess
 import sys
+import glob
 
 # Variables for 'waf dist'
 VERSION = '3.0pre0'
@@ -31,7 +32,6 @@ children = [
        'gtk2_ardour'
 ]
 
-
 i18n_children = [
        'gtk2_ardour',
        'libs/ardour'