validate
Ensures string literal keys used in translation calls exist in the source locale JSON. Calls whose first argument is not a static string are reported as dynamic (same heuristic model as sync warnings).
Literal key set: built from per-file key-site scanning so `${NS}.segment` uses each file’s own const map (duplicate NS in different files does not collide). See Duplicate const identifiers.
Limits: extraction is heuristic, not full TypeScript semantic analysis. Hook destructuring (for example const { t } = useTranslation()) is not resolved yet — configure explicit functions entries or see the unsolved inventory. See Regex and static-analysis limits and Extraction architecture.
i18nprune validate
i18nprune validate --jsonUses config functions, src, and resolved source path. See CLI overview and verbosity.
validate --json: data.count matches data.keyObservations.count (literal observation total). data.missing lists keys in code missing from the source locale JSON — use missing.length for that total, not data.count. data.dynamic.count counts non-literal call sites; issues[] may include warnings. Per-call-site literals and sites[]: i18nprune report --format json / HTML report details; dynamic file:lines: i18nprune locales dynamic (--json with --top / --full when needed).
Examples
i18nprune validate
i18nprune validate --json | jq '{ok, missing: (.data.missing|length), dynamic: .data.dynamic.count}'# CI gate
i18nprune validate --json | jq -e '.ok'# Show missing keys and observation totals explicitly
i18nprune validate --json \
| jq '{missing: .data.missing, missingCount: (.data.missing|length), keyObservations: .data.keyObservations.count, dynamic: .data.dynamic.count}'For reusable filters across commands, see the jq cookbook.
Suggested next steps
After validate, i18nprune may emit [tip] lines (and data.suggestions[] with --json) when the scan and locale files diverge:
| Situation | Stable id | Typical command |
|---|---|---|
| Source locale has keys not referenced in the code scan | suggest.cleanup.source_unused | i18nprune cleanup --dry-run |
| Target locale has extra keys vs the scan | suggest.cleanup.target_extra | i18nprune cleanup --target <code> --dry-run |
| Literal keys in code are missing from the source locale | suggest.missing.literal_keys | i18nprune missing |
Tips name the locale code and segment paths when your layout uses multiple JSON files per locale. Apply source removals with global --yes or --ask; target removals use cleanup --target <code>.