diff options
author | lovetox <philipp@hoerist.com> | 2022-05-20 21:49:55 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2022-05-20 21:57:38 +0300 |
commit | 3f481d66e2b1b963e432e9fd161c74adcd224fec (patch) | |
tree | 919eb0d2978cea87b7b77f688c43c3bf11122598 /scripts | |
parent | e52d5ccc986c9cc0f2c54527ab1f7ed378fb0e7a (diff) |
chore: Scripts: Add cleanup stale translations
Diffstat (limited to 'scripts')
-rwxr-xr-x[-rw-r--r--] | scripts/update_translations.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/update_translations.py b/scripts/update_translations.py index 4574dd8ef..20146730d 100644..100755 --- a/scripts/update_translations.py +++ b/scripts/update_translations.py @@ -1,7 +1,9 @@ +#!/usr/bin/env python3 + # File needs to stay compatible to Python 3.7 # because its run on the Gajim webserver - +import argparse import re import subprocess from pathlib import Path @@ -80,6 +82,25 @@ def update_translation_files() -> 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__': - update_translation_template() - update_translation_files() + 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() |