A robust GitHub Action and CLI tool to compare two JSON translation files (Source vs Target) for missing keys and type mismatches.
- Recursive Check: Traverses deeply nested JSON structures.
- Type Safety: Flags if value types do not match (e.g., String vs Array).
- GitHub Actions Integration: Generates a detailed Markdown report in
$GITHUB_STEP_SUMMARY. - Strict Mode: Optionally fails the CI pipeline if errors are found.
- Prerequisites: Python 3.x
- Setup:
# No dependencies required for core logic, but if you add any: pip install -r requirements.txt - Run:
python src/main.py --source en.json --target tr.json --strict
Add this to your workflow .yml file:
steps:
- uses: actions/checkout@v3
- name: Check Translations
uses: hasanbeder/translation-diff-checker@main
with:
source_file: 'locales/en.json'
target_file: 'locales/tr.json'
strict_mode: 'true'| Input | Description | Required | Default |
|---|---|---|---|
source_file |
Path to the source JSON file. | Yes | - |
target_file |
Path to the target JSON file. | Yes | - |
strict_mode |
Fail the build if differences are found (true/false). |
No | true |