CLI Commands

translate-key

Translate a single key from a source locale into target locales. Supports LLM translation with --provider.

Synopsis

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

Flags

FlagTypeRequiredDefaultDescription
--layerstringyesLayer name
--keystringyesDot-separated translation key
--sourceLocalestringyesSource locale code/language/file
--sourceValuestringnoOptional source value to write before translating
--targetsstringnoComma-separated target locales, or "all"/omitted for all except source
--overwritebooleannotrueOverwrite existing target translations (default true)
--dryRunbooleannofalsePreview without writing or translating
--includePreviewbooleannofalseInclude translated values in output
--provider=<openai|anthropic|google>stringnoLLM provider: "openai", "anthropic", or "google". Required for automatic translation.
--modelstringnoModel name (required when --provider is set)
--apiKeystringnoAPI key (falls back to OPENAI_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY env).
--baseUrlstringnoProvider base URL for gateways, self-hosted models and proxies speaking the provider's protocol. Falls back to I18N_BASE_URL, then providerBaseUrl in .i18n-mcp.json. Not supported by "google".

Every command accepts the shared flags and sets one of the exit codes documented on the overview.

Copyright © 2026