From 6645dee5ddc9721f09d1b20d50b659d0a7ba234c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Wed, 14 Mar 2012 14:10:21 +0000 Subject: [PATCH] 5621: improve update_po.py svn: r19062 --- po/update_po.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/po/update_po.py b/po/update_po.py index 685c72310..0456720f1 100644 --- a/po/update_po.py +++ b/po/update_po.py @@ -3,6 +3,8 @@ # update_po - a gramps tool to update a po file # # Copyright (C) 2006-2006 Kees Bakker +# Copyright (C) 2006 Brian Matherly +# Copyright (C) 2008 Stephen George # Copyright (C) 2012 # # This program is free software; you can redistribute it and/or modify @@ -30,7 +32,7 @@ def main(): parser = OptionParser( description='This program updates the PO file(s) for Gramps,' - ' by generating a new file for tanslator: "update.po".', + ' by generating a new file for translator', usage='%prog [options] lang.po' ) @@ -39,17 +41,27 @@ def main(): help="update all translations (not active)") (options, args) = parser.parse_args() - + if options.all: print('Not implemented yet') + + if sys.platform == 'win32': + # GetText Win 32 obtained from http://gnuwin32.sourceforge.net/packages/gettext.htm + # ....\gettext\bin\msgmerge.exe needs to be on the path + msgfmtCmd = 'msgmerge.exe' + elif sys.platform == 'linux2': + msgfmtCmd = 'msgmerge' try: os.system('''intltool-update -g gramps -o gramps.pot -p''') + print('New template') except: - continue + pass - for po in args: - os.system('''msgmerge --no-wrap %s gramps.pot -o update.po''' % po) + for po in args: + print('Merge %(lang)s with last template' % {'lang': po}) + os.system('''%s --no-wrap %s gramps.pot -o %s_updated''' % (msgfmtCmd, po, po)) + print('Updated file: %(lang)s_updated' % {'lang': po}) if __name__ == "__main__":