Gå til hovedinnhold

kapi exec translate

kapi translate [files...]

Oversett innhold med en LLM eller maskinoversettingsleverandør (velg en motor, deretter en leverandør)

Commandexec translate
Try it (demo)

Demo mode — illustrative output from a built-in stub, not a real model. Install the CLI to run with your own API key.

kapi translate messages.json --target-lang fr
Flags
FlagTypeDefaultDescription
--api-key stringAPI key for the AI provider
--batch-concurrency int1Number of concurrent batch calls (0 or 1 = sequential)
--batching stringautoHow many blocks share one LLM call (auto, single)
--concurrency , -jint0max parallel files (0 = auto)
--context stringkeyWhat the model is told about a block besides the block itself (none, key, neighbours)
--context-window int2Blocks either side to send as reference (with context: neighbours)
--credential stringsaved credential name to use (see 'kapi credentials list')
--encoding , -estringinput file encoding
--engine stringllmTranslation engine: an AI model or a machine-translation provider (AI (LLM), Machine translation)
--fail-on-unknown boolfalseexit with error if any file cannot be processed (default: skip with warning)
--format , -fstringoverride input format detection
--instruction stringExtra guidance for the model while translating (e.g. 'informal register; keep product names in English')
--json boolfalseoutput results as JSON
--map , -mstringArraymap glob pattern to format (e.g. '*.docx=okf_openxml:test')
--model stringAI model name
--no-warn boolfalsesuppress warnings for skipped files
--output , -ostringoutput path template (variables: {dir}, {name}, {ext}, {lang})
--output-dir stringwrite outputs under DIR/{lang}/ (default: beside the input, mirroring its locale layout)
--pack boolfalsewhen transforming a .kpz, also eject the result to the .kpz (auto-pack)
--parallel-blocks int0fan out block processing across N goroutines (0 = off)
--progress , -pboolfalseshow progress bar
--provider stringanthropicAI provider (Anthropic, OpenAI, Gemini, Azure OpenAI, Claude Code, Ollama, Demo (illustrative))
--reuse stringpriorOffer a block's previously approved translation to the model as reference (prior, none)
--skip-matched boolfalseSkip blocks that already have a target translation
--source-lang stringsource language (e.g. en, en-US; defaults to the project's source_language, else en)
--strict boolfalsealias for --fail-on-unknown
--target-lang stringtarget language (e.g. fr, de-DE)
--trace stringwrite flow trace JSON to file (for flow visualization)
More examples
kapi translate app.xliff --target-lang de --provider openai
kapi translate app.xliff --target-lang de -o app.de.xliff

← Back to the Command Reference