diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7acc8ddd3..ba4361b80 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,14 @@ repos: args: [--fix, --exit-non-zero-on-fix] - id: ruff-format + - repo: local + hooks: + - id: run-i18n-checks + name: Run i18n Checks + entry: python frontend/i18n/check/run_i18n_checks.py + language: python + stages: [pre-commit] + # - repo: https://github.com/pre-commit/mirrors-prettier # rev: "v4.0.0-alpha.8" # hooks: diff --git a/frontend/i18n/check/run_i18n_checks.py b/frontend/i18n/check/run_i18n_checks.py new file mode 100644 index 000000000..49a01b3c4 --- /dev/null +++ b/frontend/i18n/check/run_i18n_checks.py @@ -0,0 +1,26 @@ +import subprocess + + +def run_check(script_name): + try: + subprocess.run(["python", f"./frontend/i18n/check/{script_name}"], check=True) + print(f"{script_name} ran successfully.") + except subprocess.CalledProcessError as e: + print(f"Error running {script_name}: {e}") + raise + + +def main(): + checks = [ + "i18n_check_key_identifiers.py", + "i18n_check_non_source_keys.py", + "i18n_check_repeat_values.py", + "i18n_check_unused_keys.py", + ] + + for check in checks: + run_check(check) + + +if __name__ == "__main__": + main()