This document lists the translation Get() functions for use in go.
The base function is Language.Get(index TransIndex, ...args) (string, error)
. It takes a TransIndex (uint32) and a list of arguments, and returns either the result string or an error. All other functions are variations of this function as defined in the following function subsections.
If a translation ID is missing from a non-default language, then the translation from a fallback language is returned.
The complete list of functions under the Language
class is:
Function | Arguments | Return |
---|---|---|
string, error | ||
string, error | ||
string | ||
string | ||
string, error | ||
string, error | ||
string | ||
string |
Non-Plural functions are of the format [Must]Get[Named]. These functions DO NOT take a pluralCount uint
parameter. See Plurality rules for more information.
- Get(index TransIndex, ...args) (string, error)
- MustGet(index TransIndex, ...args) (string)
- GetNamed(nameSpace string, translationID string, ...args) (string, error)
- MustGetNamed(nameSpace string, translationID string, ...args) (string)
Plural functions are of the format [Must]GetPlural[Named]. These functions take a pluralCount uint
parameter. See Plurality rules for more information.
- Get
Plural
(index TransIndex,pluralCount
uint, ...args) (string, error) - MustGet
Plural
(index TransIndex,pluralCount
uint, ...args) (string) - Get
Plural
Named(nameSpace string, translationID string,pluralCount
uint, ...args) (string, error) - MustGet
Plural
Named(nameSpace string, translationID string,pluralCount
uint, ...args) (string)
Must functions are of the format MustGet[Plural][Named]. They return empty strings if an error occurs.
Must
Get(index TransIndex, ...args) (string)Must
GetPlural(index TransIndex, pluralCount uint, ...args) (string)Must
GetNamed(nameSpace string, translationID string, ...args) (string)Must
GetPluralNamed(nameSpace string, translationID string, pluralCount uint, ...args) (string)
Indexed functions take an index (TransIndex) to reference the Translation ID.
- Get(
index
TransIndex, ...args) (string, error) - GetPlural(
index
TransIndex, pluralCount uint, ...args) (string, error) - MustGet(
index
TransIndex, ...args) (string) - MustGetPlural(
index
TransIndex, pluralCount uint, ...args) (string)
Named functions take a namespace and translation ID to reference the Translation ID.
- Get
Named
(nameSpace
string,translationID
string, ...args) (string, error) - GetPlural
Named
(nameSpace
string,translationID
string, pluralCount uint, ...args) (string, error) - MustGet
Named
(nameSpace
string,translationID
string, ...args) (string) - MustGetPlural
Named
(nameSpace
string,translationID
string, pluralCount uint, ...args) (string)