Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
func Resolve(env, configured string, sys func() string) (lang Language, setting Setting, source string, err error)
Resolve applies environment, configuration and system-locale precedence.
func SystemLocale ¶
func SystemLocale() string
SystemLocale returns the raw locale used by auto resolution.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an initialized, immutable language catalog.
func NewWithLogger ¶
func NewWithLogger(lang Language, warn WarningFunc) (catalog *Catalog, err error)
NewWithLogger creates a catalog and sends missing-key diagnostics to warn. A nil callback uses the project's slog logger rather than writing to stderr.
type Setting ¶
type Setting string
Setting is the configured language selection mode.
func NormalizeSetting ¶
NormalizeSetting canonicalizes a language setting or returns an error listing the three values that can be persisted in configuration.
type Translator ¶
Translator is the read-only UI translation surface passed to host renderers.
func Fallback ¶
func Fallback() Translator
Fallback returns the legacy Chinese catalog for components that have not yet been wired with the startup-resolved translator. Real process assembly must always inject the resolved catalog instead.
type WarningFunc ¶
type WarningFunc func(message string)
WarningFunc receives a missing-catalog-key diagnostic.