INNER CODE UNIT · Python
rewrap
OpenChemistry/avogadrolibs · scripts/copy-default.py:320
def rewrap(path):
"""Rewrap a saved PO file with msgcat to match the Weblate layout."""
msgcat = shutil.which('msgcat')
if msgcat is None:
print("Warning: msgcat (gettext) not found; line wrapping will "
"differ from Weblate's.", file=sys.stderr)
return
result = subprocess.run([msgcat, '-o', str(path), str(path)],
capture_output=True, text=True)
if result.returncode != 0:
print(f"Warning: msgcat failed: {result.stderr.strip()}",
file=sys.stderr)
def process_file(filepath, locale_override=None, dry_run=False):
"""Fill empty msgstr entries and respell the untouched copies."""
path = Path(filepath)