vegapokerbot/internal/locale/localizer.go
2024-05-07 23:45:28 +03:00

24 lines
471 B
Go

package locale
import "github.com/nicksnyder/go-i18n/v2/i18n"
type Localizer interface {
Message(string) string
Template(string, map[string]interface{}) string
}
type localizer struct {
loc *i18n.Localizer
}
func (l *localizer) Message(str string) string {
return l.Template(str, nil)
}
func (l *localizer) Template(str string, tpl map[string]interface{}) string {
return l.loc.MustLocalize(&i18n.LocalizeConfig{
MessageID: str,
TemplateData: tpl,
})
}