Documentation ¶
Index ¶
- Variables
- type Backend
- type I18n
- func (i18n *I18n) AddTranslation(translation *Translation) error
- func (i18n *I18n) Default(value string) *I18n
- func (i18n *I18n) DeleteTranslation(translation *Translation) (err error)
- func (i18n *I18n) Fallbacks(locale ...string) *I18n
- func (i18n *I18n) LoadTranslations() map[string]map[string]*Translation
- func (i18n *I18n) SaveTranslation(translation *Translation) error
- func (i18n *I18n) Scope(scope string) *I18n
- func (i18n *I18n) SetCacheStore(cacheStore cache.CacheStoreInterface)
- func (i18n *I18n) T(locale, key string, args ...interface{}) string
- type Translation
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = "en-US"
Default default locale for i18n
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { LoadTranslations() []*Translation SaveTranslation(*Translation) error DeleteTranslation(*Translation) error }
Backend defined methods that needs for translation backend
type I18n ¶
type I18n struct { Backends []Backend FallbackLocales map[string][]string // contains filtered or unexported fields }
I18n struct that hold all translations
func (*I18n) AddTranslation ¶
func (i18n *I18n) AddTranslation(translation *Translation) error
AddTranslation add translation
func (*I18n) DeleteTranslation ¶
func (i18n *I18n) DeleteTranslation(translation *Translation) (err error)
DeleteTranslation delete translation
func (*I18n) Fallbacks ¶
Fallbacks fallback to locale if translation doesn't exist in specified locale
func (*I18n) LoadTranslations ¶
func (i18n *I18n) LoadTranslations() map[string]map[string]*Translation
LoadTranslations load translations as map `map[locale]map[key]*Translation`
func (*I18n) SaveTranslation ¶
func (i18n *I18n) SaveTranslation(translation *Translation) error
SaveTranslation save translation
func (*I18n) SetCacheStore ¶
func (i18n *I18n) SetCacheStore(cacheStore cache.CacheStoreInterface)
SetCacheStore set i18n's cache store
Click to show internal directories.
Click to hide internal directories.