Translation update done using Pootle.
[phpmyadmin.git] / scripts / mergepo.py
blob70db6bde4fdfd1de3e36556a38c0040c6133f986
1 #!/usr/bin/python
3 import polib
4 import sys
6 po = polib.pofile(sys.argv[1])
7 poupdate = polib.pofile(sys.argv[2])
9 for origentry in po.fuzzy_entries():
10 for updateentry in poupdate.translated_entries():
11 if origentry.msgctxt is None and origentry.msgid == updateentry.msgid:
12 origentry.msgstr = updateentry.msgstr
13 origentry.flags.remove('fuzzy')
14 break
15 if origentry.msgctxt == updateentry.msgctxt and origentry.msgid == updateentry.msgid:
16 origentry.msgstr = updateentry.msgstr
17 origentry.flags.remove('fuzzy')
18 break
19 for origentry in po.untranslated_entries():
20 for updateentry in poupdate.translated_entries():
21 if origentry.msgctxt is None and origentry.msgid == updateentry.msgid:
22 origentry.msgstr = updateentry.msgstr
23 break
24 if origentry.msgctxt == updateentry.msgctxt and origentry.msgid == updateentry.msgid:
25 origentry.msgstr = updateentry.msgstr
26 break
28 po.save()