mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Add a script to normalize a .po file
This commit is contained in:
parent
d3f416f830
commit
11b3d1eb80
11
scripts/normalize_po.py
Normal file
11
scripts/normalize_po.py
Normal 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)
|
Loading…
Reference in a new issue