Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LangDefault string
var LangsSupported = map[string]bool{}
Functions ¶
This section is empty.
Types ¶
type POGOCtrl ¶ added in v0.0.4
type POGOCtrl struct { Catalogs collection // contains filtered or unexported fields }
POGOCtrl is a configured handler for constructing translators
func LoadCfg ¶
LoadCfg takes the path of the project directory (relative to $GOPATH/src/) containing the POGO.toml configuration file and loads the configuration variables. Normally, this will be the main directory of your package.
func (POGOCtrl) New ¶ added in v0.0.4
func (p POGOCtrl) New(locale string) Translator
New takes a locale string and creates a new translator
func (POGOCtrl) NewQV ¶ added in v0.0.6
func (p POGOCtrl) NewQV(locales []string) Translator
NewQV takes a slice of locale strings, sorted by quality value and creates the best available translator, falling back on default (first) language if no match is found.
type Translator ¶
Translator delivers translation methods for a particular locale. It is exported for reference, but the New constructor should be used to initialize every translator.
func (Translator) G ¶
func (t Translator) G(input ...interface{}) string
G translates a string. The first argument must be the string to be translated. Any subsequent arguments will be translated, if possible, and considered arguments for sprintf.
func (Translator) NG ¶
func (t Translator) NG(input ...interface{}) string
NG translates and pluralizes a string, according to a language's pluralization rules, if the quantity calls for a plural form. The first argument must be the singular form of the string to be translated; the second must be the plural form; the *last* argument must be the quantity; any other arguments preceding it will be translated, if possible, and considered arguments for sprintf.
func (Translator) NPG ¶
func (t Translator) NPG(input ...interface{}) string
NPG translates a string with context, and pluralizes it, according to a language's pluralization rules, if the quantity calls for a plural form. The first argument must be the context, the second must be the singular form of the string to be translated; the third must be the plural form; the *last* argument must be the quantity; any other arguments preceding it will be translated, if possible, and considered arguments for sprintf.
func (Translator) PG ¶
func (t Translator) PG(input ...interface{}) string
PG translates a string with context/disambiguation. The first argument must be the context; the second must be the string to be translated. Any subsequent arguments will be translated, if possible, and considered arguments for sprintf.