-
-
Save heinrich5991/6ee787b6fabe1ff6f728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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