Skip to content

Locale checks for CI

Purpose: Fail PRs when locale JSON is invalid, literal keys are missing from en.json, or key-shape drift appears—without running destructive sync/cleanup in CI.

Current commands (i18nprune)

The legacy locales:ci script and apps/web/scripts/locales/ci/** were removed with the i18nprune migration.

From repo root:

bash
pnpm -C apps/web locales:validate
pnpm -C apps/web locales:quality

From apps/web:

bash
pnpm locales:validate
pnpm locales:quality

What each step covers

  1. locales:validate — valid JSON; literal t() / labelKey paths exist in en.json; dynamic-site warnings.
  2. locales:quality — per-locale key parity vs en.json; source-identical leaf counts (with policies.parity excludes).

Neither command writes files or calls translation APIs.

Stricter policy (optional)

Use i18nprune flags directly when wiring GitHub Actions, e.g.:

bash
cd apps/web && pnpm exec i18nprune validate -j
cd apps/web && pnpm exec i18nprune quality -j

For combined audit + fail gates (dynamic count, source-identical policy), use native i18nprune kits:

bash
cd apps/web && pnpm exec i18nprune kits honest --strict -fon missing,source-identical
# optional: -mxdy 80 to fail when dynamic sites exceed a budget

GitHub Actions

No dedicated .github/workflows/locales.yml in this repo yet. Add a job that runs the two pnpm -C apps/web commands above on changes under apps/web/locales/ and apps/web/src/.