8 from subprocess
import check_output
11 myopts
, args
= getopt
.getopt(sys
.argv
[1:], "i:o:")
12 except getopt
.GetoptError
as e
:
13 print(" Syntax: uiex -i FileIn -o FileOut")
14 print(" FileIn: Source files (*.ui)")
15 print(" FileOut: Destination file (*.*)")
24 with
open(ofile
, "a") as output
:
25 input = check_output(["xgettext", "--add-comments", "--no-wrap", ifile
, "-o", "-"])
26 po
= polib
.pofile(input)
30 keyid
= entry
.msgctxt
+ '|' + entry
.msgid
31 print >> output
, '#. ' + polib
.genKeyId(keyid
)
32 for i
, occurrence
in enumerate(entry
.occurrences
):
33 entry
.occurrences
[i
] = os
.path
.relpath(occurrence
[0], os
.environ
['SRCDIR']), occurrence
[1]
34 print >> output
, entry