language

package
v0.0.0-...-05f81da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLanguage is the default language string
	DefaultLanguage = "en_US.UTF-8"

	// RequiredBundle the bundle needed to set language other than the default
	RequiredBundle = "glibc-locale"
)

Variables

This section is empty.

Functions

func IsValidLanguage

func IsValidLanguage(l *Language) bool

IsValidLanguage verifies if the given language is valid

func SetSelectionLanguage

func SetSelectionLanguage(code string)

SetSelectionLanguage changes the default display language

func SetTargetLanguage

func SetTargetLanguage(rootDir string, language string) error

SetTargetLanguage creates a locale locale.conf on the target

Types

type Language

type Language struct {
	Code string
	Tag  language.Tag
	// contains filtered or unexported fields
}

Language represents a system language, containing the locale code and lang tag representation

func Load

func Load() ([]*Language, error)

Load uses localectl to load the currently available locales/Languages

func (*Language) Equals

func (l *Language) Equals(comp *Language) bool

Equals compares tow Language instances

func (*Language) GetConfValues

func (l *Language) GetConfValues() (string, string)

GetConfValues converts a Language to display string which can be displayed as the configured value

func (*Language) IsUserDefined

func (l *Language) IsUserDefined() bool

IsUserDefined returns true if the configuration was interactively defined by the user

func (*Language) MarshalYAML

func (l *Language) MarshalYAML() (interface{}, error)

MarshalYAML marshals Language into YAML format

func (*Language) UnmarshalYAML

func (l *Language) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals Language from YAML format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL