Commit e4bf2dbf authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Scripts: Add cleanup stale translations

parent 6ca33ca8
Pipeline #9926 passed with stage
in 10 seconds
#!/usr/bin/env python3
import argparse
import re
import subprocess
from pathlib import Path
......@@ -90,17 +91,30 @@ def build_translations() -> None:
check=True)
def cleanup_translations() -> None:
for po_file in TRANS_DIR.glob('*.po'):
subprocess.run(['msgattrib',
'--output-file',
str(po_file),
'--no-obsolete',
str(po_file)],
cwd=REPO_DIR,
check=True)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Update Translations')
parser.add_argument('command', choices=['update', 'build', 'cleanup'])
args = parser.parse_args()
if args.command == 'cleanup':
cleanup_translations()
elif args.command == 'update':
update_translation_template()
update_translation_files()
build = False
if len(sys.argv) > 1:
cmd = sys.argv[1]
if cmd == 'build':
build = True
else:
exit('Unknown commands found: %s' % sys.argv)
update_translation_template()
update_translation_files()
if build:
elif args.command == 'build':
update_translation_template()
update_translation_files()
build_translations()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment