Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolution ¶
func CoerceCLIFlag ¶ added in v0.9.2
func CoerceCLIFlag(raw string) Resolution
CoerceCLIFlag turns a raw --lang value into a Resolution tagged with SourceCLIFlag, applying the same UC-09 coercion as Resolve so an unsupported code does not bypass the supported() filter just because the user passed it on the command line.
func Resolve ¶
func Resolve(repo, global *config.Config, env Env) Resolution
Resolve walks the D-21 source chain (repo config → global config → LANG env → built-in default) and returns the active locale.
UC-09: when the resolved code is not one we ship a catalog for, we silently coerce it to "en" while keeping the original Source so dry-run and verbose-footer attribution still reflect *where* the choice came from. Erroring or warning loudly would punish users with legitimate non-en locales (LANG=de_DE.UTF-8 on a developer laptop) — silent coerce keeps the CLI usable and matches the existing i18n.Load fallback semantics one layer below.
type Source ¶
type Source int
const ( SourceDefault Source = iota SourceEnvLANG SourceGlobalConfig SourceRepoConfig // SourceCLIFlag is the highest-priority step in the D-21 chain: when the // user explicitly passes --lang on the command line, that wins over all // other sources. Resolve() does not return it directly (it has no access // to flags); callers apply the override after Resolve() and stamp this // Source so dry-run and verbose footer attribution stay accurate. SourceCLIFlag )