Documentation
¶
Overview ¶
Package i18n is for app Internationalization and Localization.
Index ¶
- Variables
- func Count() int
- func GetDescriptionByIndex(index int) string
- func GetDescriptionByLang(lang string) string
- func GetLangByIndex(index int) string
- func IndexLang(lang string) int
- func IsExist(lang string) bool
- func ListLangDescs() []string
- func ListLangs() []string
- func ReloadLangs(langs ...string) error
- func SetDefaultLang(lang string)
- func SetMessage(lang string, localeFile interface{}, otherLocaleFiles ...interface{}) error
- func SetMessageWithDesc(lang, langDesc string, localeFile interface{}, otherLocaleFiles ...interface{}) error
- func Tr(lang, format string, args ...interface{}) string
- type Locale
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrLangAlreadyExist = errors.New("Lang already exists")
)
Functions ¶
func GetDescriptionByIndex ¶
func GetDescriptionByLang ¶
func GetLangByIndex ¶
GetLangByIndex return language by given index.
func ListLangDescs ¶
func ListLangDescs() []string
func SetDefaultLang ¶
func SetDefaultLang(lang string)
SetDefaultLang sets default language which is a indicator that when target language is not found, try find in default language again.
func SetMessage ¶
SetMessage sets the message file for localization.
func SetMessageWithDesc ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.