Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("invalid language code")
ErrInvalid indicates an invalid language code was specified.
Functions ¶
Types ¶
type Language ¶ added in v0.3.0
type Language struct {
// contains filtered or unexported fields
}
Language represents a validated ISO 639-1 language code. The zero value represents "auto-detect" mode and is valid. Use Parse to create a Language from user input.
func MustParse ¶ added in v0.3.0
MustParse parses a language code and panics if invalid. Use only for compile-time constants and tests.
func Parse ¶ added in v0.3.0
Parse validates and returns a Language from a string. Empty string represents "auto-detect" mode and returns a zero Language. Returns ErrInvalid if the language code is not recognized.
func (Language) BaseCode ¶ added in v0.3.0
BaseCode returns the ISO 639-1 base code (without region). Returns empty string for auto-detect mode.
func (Language) DisplayName ¶ added in v0.3.0
DisplayName returns a human-readable name for this language. Returns empty string for auto-detect mode.