Documentation ¶
Index ¶
- Variables
- type Localizer
- func (l *Localizer) AppendIntl(lang, domain, path string, data any)
- func (l *Localizer) ErrorT(defaultValue string, args ...any) error
- func (l *Localizer) Exists(lang string) bool
- func (l *Localizer) N(orig string, args ...int) string
- func (l *Localizer) SetLanguage(lang string)
- func (l *Localizer) T(orig string) string
- func (l *Localizer) Tf(defaultValue string, args ...any) string
Constants ¶
This section is empty.
Variables ¶
View Source
var Languages = map[string]string{
"zh_CN": "简体中文",
"zh_TW": "繁體中文",
"en_US": "English",
"es_ES": "Español",
"de_DE": "Deutsch",
}
View Source
var Translations embed.FS
Functions ¶
This section is empty.
Types ¶
type Localizer ¶
type Localizer struct {
// contains filtered or unexported fields
}
func NewLocalizer ¶
func (*Localizer) AppendIntl ¶
func (*Localizer) ErrorT ¶
ErrorT produces an error with a translated error string. Substitution is performed via the `T` function above, following the same rules.
func (*Localizer) N ¶
N translates a string, possibly substituting arguments into it along the way. If len(args) is > 0, args1 is assumed to be the plural value and plural translation is used.
func (*Localizer) SetLanguage ¶
Click to show internal directories.
Click to hide internal directories.