Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import polib
def reconvert(filename):
po = polib.pofile(open(filename, encoding='utf-8').read())
lines = []
for entry in po:
if entry.msgstr:
lines.append(entry.msgid)
lines.append("== " + entry.msgstr)
lines.append("")
with open(filename + '.txt', 'w', encoding='utf-8') as out:
out.write("\n".join(lines))
if __name__ == '__main__':
import sys
for filename in sys.argv[1:]:
reconvert(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment