Documentation
¶
Overview ¶
Package i18n provides internationalization support for applications.
Index ¶
Constants ¶
View Source
const (
// Extension is the file name extension required on localization files.
Extension = ".i18n"
)
Variables ¶
View Source
var ( // Dir is the directory to scan for localization files. This will occur only once, the first time a call to Text() // is made. If you do not set this prior to the first call, a directory in the same location as the executable with // "_i18n" appended to the executable name (sans any extension) will be used. Dir string // Language is the language that should be used for text returned from calls to Text(). It is initialized to the // result of calling Locale(). You may set this at runtime, forcing a particular language for all subsequent calls // to Text(). Language = Locale() // Languages is a slice of languages to fall back to should the one specified in the Language variable not be // available. It is initialized to the value of the LANGUAGE environment variable. Languages = strings.Split(os.Getenv("LANGUAGE"), ":") )
Functions ¶
func Locale ¶ added in v1.1.4
func Locale() string
Locale returns the value of the LC_ALL environment variable, if set. If not, then it falls back to the value of the LANG environment variable. If that is also not set, then it returns "en_US.UTF-8".
func SetLocalizer ¶ added in v1.109.0
SetLocalizer sets the function to use for localizing text. If this is not set or explicitly set to nil, the default localization mechanism will be used.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.