Versions in this module Expand all Collapse all v2 v2.2.2 Dec 7, 2022 Changes in this version + type Bundle struct + func NewBundle(defaultLanguage language.Tag) *Bundle + func (b *Bundle) AddMessages(tag language.Tag, messages ...*Message) error + func (b *Bundle) LanguageTags() []language.Tag + func (b *Bundle) LoadMessageFile(path string) (*MessageFile, error) + func (b *Bundle) LoadMessageFileFS(fsys fs.FS, path string) (*MessageFile, error) + func (b *Bundle) MustAddMessages(tag language.Tag, messages ...*Message) + func (b *Bundle) MustLoadMessageFile(path string) + func (b *Bundle) MustParseMessageFileBytes(buf []byte, path string) + func (b *Bundle) ParseMessageFileBytes(buf []byte, path string) (*MessageFile, error) + func (b *Bundle) RegisterUnmarshalFunc(format string, unmarshalFunc UnmarshalFunc) + type LocalizeConfig struct + DefaultMessage *Message + Funcs template.FuncMap + MessageID string + PluralCount interface{} + TemplateData interface{} + type Localizer struct + func NewLocalizer(bundle *Bundle, langs ...string) *Localizer + func (l *Localizer) GetMessageTemplate(id string, defaultMessage *Message) (language.Tag, *MessageTemplate, error) + func (l *Localizer) Localize(lc *LocalizeConfig) (string, error) + func (l *Localizer) LocalizeMessage(msg *Message) (string, error) + func (l *Localizer) LocalizeWithTag(lc *LocalizeConfig) (string, language.Tag, error) + func (l *Localizer) MustLocalize(lc *LocalizeConfig) string + type Message struct + Description string + Few string + Hash string + ID string + LeftDelim string + Many string + One string + Other string + RightDelim string + Two string + Zero string + func MustNewMessage(data interface{}) *Message + func NewMessage(data interface{}) (*Message, error) + type MessageFile struct + Format string + Messages []*Message + Path string + Tag language.Tag + func ParseMessageFileBytes(buf []byte, path string, unmarshalFuncs map[string]UnmarshalFunc) (*MessageFile, error) + type MessageNotFoundErr struct + func (e *MessageNotFoundErr) Error() string + type MessageTemplate struct + PluralTemplates map[plural.Form]*internal.Template + func NewMessageTemplate(m *Message) *MessageTemplate + func (mt *MessageTemplate) Execute(pluralForm plural.Form, data interface{}, funcs template.FuncMap) (string, error) + type UnmarshalFunc func(data []byte, v interface{}) error Other modules containing this package github.com/LinkinStars/go-i18n