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

FlagTypeRequiredDefaultDescription
--layerstringno—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, --refstringno—Locale code used as the translation source (e.g., "en", "en-US"). Defaults to the project default locale.
--targetLocales, --targetsstringno—Locale codes to translate into (e.g., "de", "fr", "sv"). Defaults to all locales except the reference. Comma-separated.
--keysstringno—Dot-path keys to translate (e.g., "auth.login.title", "common.save"). If omitted, translates every missing key in the layer. Comma-separated.
--batchSizestringno—Maximum number of keys per provider request. Default: 50. A lower value reduces per-batch risk and increases round trips.
--overwriteStalebooleannofalseAlso 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.
--dryRunbooleannofalseReturn which keys would be translated without calling the provider or writing files. Default: false.
--provider=<openai|anthropic|google>stringno—LLM provider to translate through. Without one nothing is translated automatically — the result carries the contexts to translate by hand instead.
--modelstringno—Model name. Required whenever a provider is set.
--apiKeystringno—API key. Falls back to the OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY environment variables.
--baseUrlstringno—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.
--failOnFailedbooleannofalseExit 2 when any key failed to translate (CI gate).
Copyright © 2026