Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLocale ¶
SetLocale sets the current locale to the given value. If the locale is not in a valid format, this function will return an error and leave the current locale as is.
func SetMessagesDir ¶
func SetMessagesDir(d string)
SetMessagesDir sets the directory from which to load translations if they are not under the default directory 'locale'
func SetMessagesFunc ¶
func SetMessagesFunc(f ReadFunc)
SetMessagesFunc tells i18n to read translations through ReadFunc
func T ¶
T translates the given key into a message based on the current locale, formatting the string using the supplied (optional) args. This method will fall back to other locales if the key isn't defined for the current locale. The search order (with examples) is as follows:
- current locale (zh_CN)
- lang only (zh)
- default locale (en_US)
- lang only of default (en)
func UseOSLocale ¶
func UseOSLocale() error
UseOSLocale detect OS locale for current user and let i18n to use it