ref: 5946e4a5438bbcdf58d8ca981a15414d84f02ec6
i18n/xml2po.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#!/bin/python3 import sys ids = {} msgs = {} with open('ids') as ids_file: for line in ids_file.readlines(): id, msg = line.split(' = ') ids[id] = msg.strip() for line in sys.stdin.readlines(): id, msg = line.split(' = ') msgs[id] = msg.strip() print('''#, fuzzy msgid "" msgstr "" "MIME-Version: 1.0\\n" "Content-Transfer-Encoding: 8bit\\n" "Content-Type: text/plain; charset=UTF-8\\n" ''') for id, msg in msgs.items(): print(f'msgid "{ids[id]}"') print(f'msgstr "{msg}"') |