Gå til hovedinnhold

kapi exec translate

kapi translate [files...]

Translate content with an LLM or machine-translation provider (select an engine, then a provider)

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-keystringAPI key for the AI provider
--batch-concurrencyint1Number of concurrent batch calls (0 or 1 = sequential)
--batchingstringautoHow many blocks share one LLM call (auto, single)
--concurrency, -jint0max parallel files (0 = auto)
--contextstringkeyWhat the model is told about a block besides the block itself (none, key, neighbours)
--context-windowint2Blocks either side to send as reference (with context: neighbours)
--credentialstringsaved credential name to use (see 'kapi credentials list')
--encoding, -estringUTF-8input file encoding
--enginestringllmTranslation engine: an AI model or a machine-translation provider (AI (LLM), Machine translation)
--fail-on-unknownboolfalseexit with error if any file cannot be processed (default: skip with warning)
--format, -fstringoverride input format detection
--instructionstringExtra guidance for the model while translating (e.g. 'informal register; keep product names in English')
--jsonboolfalseoutput results as JSON
--map, -mstringArraymap glob pattern to format (e.g. '*.docx=okf_openxml:test')
--modelstringAI model name
--no-warnboolfalsesuppress warnings for skipped files
--output, -ostringoutput path template (variables: {dir}, {name}, {ext}, {lang})
--output-dirstringwrite outputs under DIR/{lang}/ (default: beside the input, mirroring its locale layout)
--packboolfalsewhen transforming a .kpz, also eject the result to the .kpz (auto-pack)
--parallel-blocksint0fan out block processing across N goroutines (0 = off)
--progress, -pboolfalseshow progress bar
--providerstringanthropicAI provider (Anthropic, OpenAI, Gemini, Azure OpenAI, Claude Code, Ollama, Demo (illustrative))
--skip-matchedboolfalseSkip blocks that already have a target translation
--source-langstringensource language (e.g. en, en-US)
--strictboolfalsealias for --fail-on-unknown
--target-langstringtarget language (e.g. fr, de-DE)
--tracestringwrite 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