Documentation
¶
Index ¶
- Variables
- func ResetDefaultLocales()
- func Tr(lang, trKey string, trArgs ...interface{}) string
- type LocaleStore
- func (ls *LocaleStore) AddLocaleByIni(langName, langDesc string, source, moreSource []byte) error
- func (ls *LocaleStore) HasLang(langName string) bool
- func (ls *LocaleStore) ListLangNameDesc() (names, desc []string)
- func (ls *LocaleStore) SetDefaultLang(lang string)
- func (ls *LocaleStore) Tr(lang, trKey string, trArgs ...interface{}) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLocaleAlreadyExist = errors.New("lang already exists") DefaultLocales = NewLocaleStore() )
Functions ¶
func ResetDefaultLocales ¶
func ResetDefaultLocales()
Types ¶
type LocaleStore ¶
type LocaleStore struct {
// contains filtered or unexported fields
}
func NewLocaleStore ¶
func NewLocaleStore() *LocaleStore
func (*LocaleStore) AddLocaleByIni ¶
func (ls *LocaleStore) AddLocaleByIni(langName, langDesc string, source, moreSource []byte) error
AddLocaleByIni adds locale by ini into the store
func (*LocaleStore) HasLang ¶
func (ls *LocaleStore) HasLang(langName string) bool
func (*LocaleStore) ListLangNameDesc ¶
func (ls *LocaleStore) ListLangNameDesc() (names, desc []string)
func (*LocaleStore) SetDefaultLang ¶
func (ls *LocaleStore) SetDefaultLang(lang string)
SetDefaultLang sets default language as a fallback
func (*LocaleStore) Tr ¶
func (ls *LocaleStore) Tr(lang, trKey string, trArgs ...interface{}) string
Tr translates content to target language. fall back to default language.
Click to show internal directories.
Click to hide internal directories.