CLI Commands

translate-key

Add or update one source translation key and translate it into the target locales.

Synopsis

the-i18n-cli translate-key --layer <layer> --key <key> --sourceLocale <sourceLocale>

Flags

FlagTypeRequiredDefaultDescription
--layerstringyes—Layer holding the key, from discover (e.g., "root", "app-admin").
--keystringyes—Dot-separated key path to translate. Example: "bookingCreator.options.removeSubResource".
--sourceLocalestringyes—Source locale ref. May be a code ("en-us"), a language ("en-US") or a file ("en-US.json").
--sourceValuestringno—Source value to write before translating. If omitted, the existing source value is read.
--targetLocales, --targetsstringno—Locales to translate into. Pass "all", or omit, for every locale except the source. Comma-separated, or "all".
--overwritebooleannotrueOverwrite existing target translations. When false, only missing targets are filled. Default: true.
--dryRunbooleannofalseReport the source and target locales without writing files or calling the translation backend. Default: false.
--includePreviewbooleannofalseInclude the translated values in the result. Default: false, which keeps the response compact.
--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.
Copyright © 2026