Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLocalNotFound = errors.New("locale not found")
Functions ¶
This section is empty.
Types ¶
type Locale ¶
type Locale struct {
// contains filtered or unexported fields
}
Locale represents a locale with target language and a collection of messages.
func (*Locale) Description ¶
Description returns the descriptive name of the locale.
func (*Locale) TranslateWithFallback ¶
TranslateWithFallback uses the locale to translate the message of the given key. It attempts to use the `fallback` to translate if the given key does not exist in the locale.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a message in a locale.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store contains a collection of locales and their descriptive names.
func (*Store) AddLocale ¶
func (s *Store) AddLocale(lang, desc string, source interface{}, others ...interface{}) (*Locale, error)
AddLocale adds a locale with given language name and description that is loaded from the list of sources. Please refer to INI documentation regarding what is considered as a valid data source: https://ini.unknwon.io/docs/howto/load_data_sources.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
plural
Package plural provides support for pluralizing messages according to CLDR rules defined in http://cldr.unicode.org/index/cldr-spec/plural-rules.
|
Package plural provides support for pluralizing messages according to CLDR rules defined in http://cldr.unicode.org/index/cldr-spec/plural-rules. |