CLI Commands
translate
Find the keys missing in the target locales and translate them. Without a translation backend nothing is written: the result carries per-locale fallback contexts to translate by hand instead.
Synopsis
the-i18n-cli translate
Flags
| Flag | Type | Required | Default | Description |
|---|---|---|---|---|
--layer | string | no | — | Layer to translate (e.g., "root", "app-admin"). Omit to translate every locale-backed layer in one call — the recommended default for layered projects, which returns a result per layer plus an aggregated summary. |
--referenceLocale, --ref | string | no | — | Locale code used as the translation source (e.g., "en", "en-US"). Defaults to the project default locale. |
--targetLocales, --targets | string | no | — | Locale codes to translate into (e.g., "de", "fr", "sv"). Defaults to all locales except the reference. Comma-separated. |
--keys | string | no | — | Dot-path keys to translate (e.g., "auth.login.title", "common.save"). If omitted, translates every missing key in the layer. Comma-separated. |
--batchSize | string | no | — | Maximum number of keys per provider request. Default: 50. A lower value reduces per-batch risk and increases round trips. |
--overwriteStale | boolean | no | false | Also re-translate keys whose target value was written from source text that has changed since. Needs the translation memory, which is on unless translationMemory is false in the project config — without it nothing is known to be stale and this changes nothing. Default: false, which reports those keys under "stale" and leaves their values alone. |
--dryRun | boolean | no | false | Return which keys would be translated without calling the provider or writing files. Default: false. |
--provider=<openai|anthropic|google> | string | no | — | LLM provider to translate through. Without one nothing is translated automatically — the result carries the contexts to translate by hand instead. |
--model | string | no | — | Model name. Required whenever a provider is set. |
--apiKey | string | no | — | API key. Falls back to the OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY environment variables. |
--baseUrl | string | no | — | Provider base URL for gateways, self-hosted models and proxies speaking the provider's protocol. Falls back to I18N_BASE_URL, then to providerBaseUrl in .i18n-mcp.json. |
--failOnFailed | boolean | no | false | Exit 2 when any key failed to translate (CI gate). |