What the CLI does
@json-translate/check compares translated JSON locale files against a source locale. It is designed for the last step after translation: the point where a developer wants to know whether a translated file can safely enter a build.
- It fails when a target file cannot be parsed as JSON.
- It reports keys that exist in the source but are missing from the translation.
- It reports extra keys that appeared in the translated file.
- It compares placeholder tokens such as
{name},{{count}},${value}, and%s.
Run it with npx
You do not need a project dependency to try it:
npx @json-translate/check --source locales/en.json --target locales/fr.json --target locales/de.json
Example failure
If the French locale lost a key, added an obsolete key, and dropped a placeholder:
FAIL locales/fr.json
missing key: nav.save
extra key: legacy.banner
placeholder missing at greeting: {name}
Where it fits
Use JSON Translate to create draft translations, then run the CLI before merge. The CLI is intentionally narrow: it does not judge translation quality, tone, or grammar. It checks the file-level mistakes that are easiest to automate.
Best first workflow: add the checker to CI for every locale file your application loads at runtime, so missing keys and broken placeholders become pull-request failures instead of customer-facing bugs.
Useful links
Originally published on the JSON Translate blog.
Top comments (0)