i18n

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DomainKusion = "kusion"

	LangEnUS      = "en_US"
	LangZhCN      = "zh_CN"
	LangValueEnUS = "en_US.UTF-8"
	LangValueZhCN = "zh_CN.UTF-8"

	EnvKeyLanguage   = "LANGUAGE"
	EnvKeyLcAll      = "LC_ALL"
	EnvKeyLcMessages = "LC_MESSAGES"
	EnvKeyLang       = "LANG"
)

Variables

This section is empty.

Functions

func Errorf

func Errorf(defaultValue string, args ...int) error

Errorf produces an error with a translated error string. Substitution is performed via the `T` function above, following the same rules.

func LoadTranslations

func LoadTranslations(root string, getLanguageFn func() string) error

LoadTranslations loads translation files. getLanguageFn should return a language string (e.g. 'en-US'). If getLanguageFn is nil, then the loadSystemLanguage function is used, which uses the 'LANG' environment variable.

func T

func T(defaultValue string, args ...int) string

T translates a string, possibly substituting arguments into it along the way. If len(args) is > 0, args1 is assumed to be the plural value and plural translation is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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