diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-29 17:22:38 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-29 17:22:46 +0200 |
commit | 5131005e5b26d12b5b3f79c1c3f8ee08172fc386 (patch) | |
tree | 410ce424281deafb222cfe493654a30c7d5d643e /share/qt/extract_strings_qt.py | |
parent | d8e862a5a7537ac6d247d794a3d41e6eab270060 (diff) | |
parent | 18f05c765c800126b74a6d5b7f33cef7c9aae1b7 (diff) |
Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)
Diffstat (limited to 'share/qt/extract_strings_qt.py')
-rwxr-xr-x | share/qt/extract_strings_qt.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/share/qt/extract_strings_qt.py b/share/qt/extract_strings_qt.py index 2a6e4b930c..7728a43775 100755 --- a/share/qt/extract_strings_qt.py +++ b/share/qt/extract_strings_qt.py @@ -1,8 +1,9 @@ #!/usr/bin/python ''' -Extract _("...") strings for translation and convert to Qt4 stringdefs so that +Extract _("...") strings for translation and convert to Qt stringdefs so that they can be picked up by Qt linguist. ''' +from __future__ import division,print_function,unicode_literals from subprocess import Popen, PIPE import glob import operator @@ -52,10 +53,14 @@ files = sys.argv[1:] # xgettext -n --keyword=_ $FILES XGETTEXT=os.getenv('XGETTEXT', 'xgettext') +if not XGETTEXT: + print('Cannot extract strings: xgettext utility is not installed or not configured.',file=sys.stderr) + print('Please install package "gettext" and re-run \'./configure\'.',file=sys.stderr) + exit(1) child = Popen([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE) (out, err) = child.communicate() -messages = parse_po(out) +messages = parse_po(out.decode('utf-8')) f = open(OUT_CPP, 'w') f.write(""" |