summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-11-21 21:52:36 +0000
committerDavid Robillard <d@drobilla.net>2011-11-21 21:52:36 +0000
commit6799cc87e220f04e21bf4d87561281119df10523 (patch)
tree633500fc5eaf0456c973618f226ad5989340133d
parent370eba52f809a3330b81eadf63c1018f845791f9 (diff)
downloadautowaf-6799cc87e220f04e21bf4d87561281119df10523.tar.gz
autowaf-6799cc87e220f04e21bf4d87561281119df10523.tar.bz2
autowaf-6799cc87e220f04e21bf4d87561281119df10523.zip
Apply i18n updates from Paul Davis.
git-svn-id: http://svn.drobilla.net/autowaf@60 e2e4594f-ea7b-45dc-bc5a-5f5301e603aa
-rw-r--r--autowaf.py76
1 files changed, 42 insertions, 34 deletions
diff --git a/autowaf.py b/autowaf.py
index c329bf1..472d6e1 100644
--- a/autowaf.py
+++ b/autowaf.py
@@ -424,52 +424,60 @@ def build_version_files(header_path, source_path, domain, major, minor, micro):
return None
-def build_i18n(bld, srcdir, dir, name, sources, copyright_holder=None):
- pwd = os.getcwd()
- os.chdir(os.path.join(srcdir, dir))
-
+def build_i18n_pot(bld, srcdir, dir, name, sources, copyright_holder=None):
+ Logs.info('Generating pot file from %s' % name)
pot_file = '%s.pot' % name
- args = [ 'xgettext',
- '--keyword=_',
- '--keyword=N_',
- '--from-code=UTF-8',
- '-o', pot_file ]
+ cmd = [ 'xgettext',
+ '--keyword=_',
+ '--keyword=N_',
+ '--keyword=S_',
+ '--from-code=UTF-8',
+ '-o', pot_file ]
if copyright_holder:
- args += [ '--copyright-holder="%s"' % copyright_holder ]
+ cmd += [ '--copyright-holder="%s"' % copyright_holder ]
- def msg(str):
- sys.stdout.write(str + ' ')
- sys.stdout.flush()
+ cmd += sources
+ Logs.info('Updating ' + pot_file)
+ subprocess.call(cmd, cwd=os.path.join(srcdir, dir))
- args += sources
- msg('Updating ' + pot_file)
- os.spawnvp(os.P_WAIT, 'xgettext', args)
-
+def build_i18n_po(bld, srcdir, dir, name, sources, copyright_holder=None):
+ pwd = os.getcwd()
+ os.chdir(os.path.join(srcdir, dir))
+ pot_file = '%s.pot' % name
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 ]
- msg('Updating ' + po_file)
- os.spawnvp(os.P_WAIT, 'msgmerge', args)
-
+ cmd = [ 'msgmerge',
+ '--update',
+ po_file,
+ pot_file ]
+ Logs.info('Updating ' + po_file)
+ subprocess.call(cmd)
+ os.chdir(pwd)
+
+def build_i18n_mo(bld, srcdir, dir, name, sources, copyright_holder=None):
+ pwd = os.getcwd()
+ os.chdir(os.path.join(srcdir, dir))
+ pot_file = '%s.pot' % name
+ po_files = glob.glob('po/*.po')
for po_file in po_files:
mo_file = po_file.replace('.po', '.mo')
- args = [ 'msgfmt',
- '-c',
- '-f',
- '-o',
- mo_file,
- po_file ]
- msg('Generating ' + po_file)
- os.spawnvp(os.P_WAIT, 'msgfmt', args)
+ cmd = [ 'msgfmt',
+ '-c',
+ '-f',
+ '-o',
+ mo_file,
+ po_file ]
+ Logs.info('Generating ' + po_file)
+ subprocess.call(cmd)
os.chdir(pwd)
+def build_i18n(bld, srcdir, dir, name, sources, copyright_holder=None):
+ build_i18n_pot(bld, srcdir, dir, name, sources, copyright_holder)
+ build_i18n_po(bld, srcdir, dir, name, sources, copyright_holder)
+ build_i18n_mo(bld, srcdir, dir, name, sources, copyright_holder)
+
def cd_to_build_dir(ctx, appname):
orig_dir = os.path.abspath(os.curdir)
top_level = (len(ctx.stack_path) > 1)