Skip to content

Commit

Permalink
Merge pull request activist-org#995 from zeus2611/990-i18n-local-test
Browse files Browse the repository at this point in the history
feat: Function to run all i18n tests locally
  • Loading branch information
andrewtavis authored Oct 23, 2024
2 parents dc8bc7d + cb729a0 commit 7517dce
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
26 changes: 26 additions & 0 deletions frontend/i18n/check/run_i18n_checks.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 7517dce

Please sign in to comment.