Skip to content

Locale Fill CLI

apps/web/scripts/locales/fill/index.ts

Fill re-translates only the string paths where a non-English locale still has the same value as English (same detection rules as locales:validate:quality). Use this after sync when you want Google Translate (or the configured pipeline) to replace English-identical placeholders without running a full locales:generate pass.

Commands

Run from apps/web:

  • pnpm locales:fill
  • pnpm locales:fill -- --lang <slug>
  • pnpm locales:fill -- --all
  • pnpm locales:fill -- --dry-run --lang <slug>
  • pnpm locales:fill -- --review --lang <slug>

Backward-compatible alias: pnpm locales:generate:fill runs the same script.

pnpm locales:generate -- --fill still delegates to this tool (same behavior).

Flags

  • --dry-run — no API calls, no file writes; shows what would be re-translated.
  • --review — extra confirmation before translation starts.
  • --lang <code> / --lang=<code> — target locale file slug (e.g. zh-cn, id).
  • --all — run fill for every non-en locale file, one after another.

What it updates

  • Only locales/<slug>.json (no config.ts / index.ts changes — those belong to full generate). Each re-translated path gets updated review metadata (status, confidence, needsReview, source, updatedAt) alongside value. See locale-leaves.md.

Preserve / parity rules

Fill respects the same English-identical detection and exclusions as sync parity. See shared.md (EXCLUDE_EN_COMPARE_*, preserve keys).

  • generate.md — full locale generation (new languages, full re-translate).
  • sync.md — key-shape sync and parity reporting.
  • examples.md — end-to-end workflows.