diff options
author | David Robillard <d@drobilla.net> | 2010-02-03 19:02:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-03 19:02:09 +0000 |
commit | 249bc2f7443dfacb6b0ad06616196940e6fe1e6e (patch) | |
tree | 322928d26f6e5617057fddd349b6a57fe4a05acb /autowaf.py | |
parent | 0a508ffb5dd5fc3251fdb9d71d022b1c2bf4ba9e (diff) |
Move i18n stuff into autowaf.
git-svn-id: svn://localhost/ardour2/branches/3.0@6630 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'autowaf.py')
-rw-r--r-- | autowaf.py | 38 |
1 files changed, 38 insertions, 0 deletions
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']: |