Hi, > Arggh!!! What happened?! Diffing the POT file with the previous version > gives me four thousand eight hundred lines!!
Two main changes happened in the .po files: Longer translations were split to more shorter ones (which will help maintainability in the long run), and the strings were reformatted. I've hacked together a quick script that recoveres most of the translations. The attached script replaces some of the empty translations to fuzzy ones. It looks for an obsoleted longer msgid that contains the new msgid as a substring, allowing whitespace changes; and if found then this becomes the fuzzy translation. You still have to manually remove the irrelevant options and manually reformat, but that's an easy boring mechanical task. You don't need to look elsewhere for the old translation, or re-translate. I hope you find it useful. I have just barely tested, let me know if it breaks something. For most languages it turns about 300 empty translations into such fuzzy but usable ones. Usage: proggyname input-po-file output-po-file Needs pyton3-polib, most likely available in your distro. e.
#!/usr/bin/python3 # https://github.com/izimobil/polib/ # https://pypi.org/project/polib/ import polib import sys if len(sys.argv) != 3: print('Usage: coreutils-help-hyperlink-po-fixer.py input-po-file output-po-file\n') sys.exit(1) po = polib.pofile(sys.argv[1]) for entry in po: entry.msgid_squeezed = " ".join(entry.msgid.split()) count = 0 for entry in po: if entry.msgstr != "" or entry.fuzzy or entry.obsolete: continue found = False for e2 in po: if len(entry.msgid_squeezed) < len(e2.msgid_squeezed) and entry.msgid_squeezed in e2.msgid_squeezed: entry.msgstr += e2.msgstr entry.fuzzy = True found = True # break?? if found: count += 1 po.save(sys.argv[2]) print(f'Resurrected {count} hopefully useful fuzzy translations')
