diff --git a/autowaf.py b/autowaf.py index e59c134a43..93f0910eb2 100644 --- a/autowaf.py +++ b/autowaf.py @@ -10,6 +10,7 @@ import Configure import Options import Utils import sys +import glob from TaskGen import feature, before, after global g_is_child @@ -366,6 +367,43 @@ def build_version_files(header_path, source_path, domain, major, minor, micro): return None +# Internationalisation (gettext) +def build_i18n(bld,dir,name,sources): + pwd = bld.get_curdir() + os.chdir(pwd) + + pot_file = '%s.pot' % name + + args = [ 'xgettext', + '--keyword=_', + '--keyword=N_', + '--from-code=UTF-8', + '-o', pot_file, + '--copyright-holder="Paul Davis"' ] + args += sources + Utils.pprint('GREEN', 'Updating ' + pot_file, sep='') + os.spawnvp (os.P_WAIT, 'xgettext', args) + + po_files = glob.glob ('po/*.po') + + for po_file in po_files: + args = [ 'msgmerge', + '--update', + po_file, + pot_file ] + Utils.pprint('GREEN', 'Updating ' + po_file, sep='') + 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 ] + Utils.pprint('GREEN', 'Generating ' + po_file) + os.spawnvp (os.P_WAIT, 'msgfmt', args) + def shutdown(): # This isn't really correct (for packaging), but people asking is annoying if Options.commands['install']: diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index cd52ce3728..05725a7e7a 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -6,7 +6,6 @@ import Options import sys import TaskGen import re -from w18n import build_i18n # Version of this package (even if built as a child) MAJOR = '1' @@ -418,5 +417,5 @@ def build(bld): bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo) def i18n(bld): - build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources) + autowaf.build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index cb62735f0f..33de254b36 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -5,7 +5,6 @@ import glob import Options import re import subprocess -from w18n import build_i18n # Version of this package (even if built as a child) MAJOR = '3' @@ -351,4 +350,4 @@ def shutdown(): autowaf.shutdown() def i18n(bld): - build_i18n (bld, 'libs/ardour', APPNAME, libardour_sources) + autowaf.build_i18n (bld, 'libs/ardour', APPNAME, libardour_sources) diff --git a/w18n.py b/w18n.py deleted file mode 100644 index 2605de3592..0000000000 --- a/w18n.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -import autowaf -import os -import glob - -def build_i18n(bld,dir,name,sources): - pwd = bld.get_curdir() - os.chdir(pwd) - - 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') - - 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)