Add a script to normalize a .po file

This commit is contained in:
heinrich5991 2014-05-04 15:25:10 +02:00 committed by oy
parent d3f416f830
commit 11b3d1eb80

11
scripts/normalize_po.py Normal file
View file

@ -0,0 +1,11 @@
import polib
import sys
if __name__ == '__main__':
for filename in sys.argv[1:]:
po = polib.pofile(open(filename).read())
entries = list(sorted(sorted(po, key=lambda x: x.msgctxt or ""), key=lambda x: x.msgid))
po.clear()
for entry in entries:
po.append(entry)
po.save(filename)