3 Script to automatically merge pending translations from Pootle into po files.
5 It only accepts those, which are not translated or fuzzy.
11 po
= polib
.pofile(sys
.argv
[1])
12 poupdate
= polib
.pofile(sys
.argv
[2])
14 for updateentry
in poupdate
:
15 msgid
= updateentry
.msgid
.split('\n', 1)[1]
16 if msgid
== updateentry
.msgstr
:
18 origentry
= po
.find(msgid
)
21 if origentry
.msgstr
== '' or 'fuzzy' in origentry
.flags
:
22 origentry
.msgstr
= updateentry
.msgstr
24 origentry
.msgstr_plural
= updateentry
.msgstr_plural
25 except AttributeError:
27 if 'fuzzy' in origentry
.flags
:
28 origentry
.flags
.remove('fuzzy')