Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Recognized ¶ added in v1.6.0
Recognized is the exported form of recognized, for callers that validate a language value before storing it (e.g. `config set output.lang`).
func UICatalogFor ¶ added in v1.6.0
UICatalogFor maps a raw language value (e.g. a --lang flag) to the interface catalog code to load: the value itself when we ship a catalog for it, else English. Used by early-error paths that have a raw flag but no resolved Resolution yet.
Types ¶
type Resolution ¶
Resolution is the outcome of the language chain. Code is the resolved language and drives the AI **output** language verbatim (so an output-only language like "fr" is preserved). Name is its display name for the prompt directive. Source records which step of the chain decided it, for dry-run and verbose-footer attribution.
The CLI **interface** language is derived separately via UICatalog(): the output language and the interface language share one resolution but the interface only localizes to languages we ship a catalog for.
func English ¶ added in v1.6.0
func English() Resolution
English is the terminal fallback of the chain, and a convenience constructor for callers that always want English output (e.g. the eval harness, which pins fixtures to a deterministic language).
func Resolve ¶
func Resolve(flag string, repo, global *config.Config) Resolution
Resolve walks the language source chain and returns the resolved output language:
--lang flag → repo config (output.lang) → user config (output.lang) → English
At every step a value that is empty OR not a recognized language falls through to the next source — it never short-circuits to English mid-chain. The system locale (LANG env var) is deliberately NOT consulted: language is config-driven only (ADR-0021, superseding the D-21 / UC-09 env-LANG step).
flag is the raw `--lang` value ("" when the flag was not passed). repo and global are the raw per-file configs (config.LoadFile, not the merged config) so each level is judged on its own stated value.
func (Resolution) UICatalog ¶ added in v1.6.0
func (r Resolution) UICatalog() string
UICatalog returns the language code to load CLI interface strings for: the resolved code when we ship a catalog for it (en, tr), otherwise English. This is what makes `--lang fr` produce French *output* while the CLI's own chrome stays English — the two are resolved from the same chain but the interface degrades to English for any language we haven't translated.