Documentation ¶
Overview ¶
Internationalization implementation using nicksnyder/go-i18n
Index ¶
- func New(cfg *Config) (localize.Localizer, error)
- type Config
- type Goi18n
- func (l *Goi18n) MustLocalize(id string, tmplEntries ...*localize.TemplateEntry) string
- func (l *Goi18n) MustLocalizeError(id string, tmplEntries ...*localize.TemplateEntry) error
- func (l *Goi18n) MustLocalizeFile(files fs.FS, path string) (err error)
- func (l *Goi18n) MustLocalizePlural(id string, pluralCount int, tmplEntries ...*localize.TemplateEntry) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Goi18n ¶
type Goi18n struct {
// contains filtered or unexported fields
}
go-i18n implementation
func (*Goi18n) MustLocalize ¶
func (l *Goi18n) MustLocalize(id string, tmplEntries ...*localize.TemplateEntry) string
MustLocalize loads a i18n message from the file system You can pass dynamic values using template entries Examples:
`localizer.MustLocalize("my-message-id", &localize.TemplateEntry{"Name", "Danny"})`
func (*Goi18n) MustLocalizeError ¶
func (l *Goi18n) MustLocalizeError(id string, tmplEntries ...*localize.TemplateEntry) error
MustLocalizeError loads a i18n message from the file system and returns an error Examples:
`err := localizer.MustLocalizeError("my-message-id", &localize.TemplateEntry{"Name", "Danny"}`
func (*Goi18n) MustLocalizeFile ¶
read the message file from the file system
func (*Goi18n) MustLocalizePlural ¶
func (l *Goi18n) MustLocalizePlural(id string, pluralCount int, tmplEntries ...*localize.TemplateEntry) string
MustLocalizePlural loads a pluralized i18n message from the file system You can pass dynamic values using template entries Examples:
`localizer.MustLocalizePlural("my-message-id", 2)`