From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- solenv/bin/uiex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 solenv/bin/uiex (limited to 'solenv/bin/uiex') diff --git a/solenv/bin/uiex b/solenv/bin/uiex new file mode 100755 index 000000000..c9b00b2e0 --- /dev/null +++ b/solenv/bin/uiex @@ -0,0 +1,34 @@ +#!/usr/bin/python + +import polib +import binascii +import getopt +import sys +import os.path +from subprocess import check_output + +try: + myopts, args = getopt.getopt(sys.argv[1:], "i:o:") +except getopt.GetoptError as e: + print(" Syntax: uiex -i FileIn -o FileOut") + print(" FileIn: Source files (*.ui)") + print(" FileOut: Destination file (*.*)") + sys.exit(2) + +for o, a in myopts: + if o == '-i': + ifile = a + elif o == '-o': + ofile = a + +with open(ofile, "a") as output: + input = check_output(["xgettext", "--add-comments", "--no-wrap", ifile, "-o", "-"]) + po = polib.pofile(input) + if len(po) != 0: + print >> output, "" + for entry in po: + keyid = entry.msgctxt + '|' + entry.msgid + print >> output, '#. ' + polib.genKeyId(keyid) + for i, occurrence in enumerate(entry.occurrences): + entry.occurrences[i] = os.path.relpath(occurrence[0], os.environ['SRCDIR']), occurrence[1] + print >> output, entry -- cgit v1.2.3