Versions in this module Expand all Collapse all v1 v1.0.1 Mar 8, 2024 Changes in this version type Translations + Remove bool v1.0.0 Mar 8, 2024 Changes in this version + const DefaultDomain + const DefaultSourceCodeLocale + const HTTPHeaderAcceptLanguage + var Mark = noop(0) + func Bind(domain, path string) + func BindFS(domain string, fsys fs.FS) + func Domain() string + func Domains() []string + func GetCtxDomain(ctx context.Context) (string, bool) + func GetCtxLocale(ctx context.Context) (string, bool) + func GetUserLang(request *http.Request, opts ...getUserLangOpt) string + func HasDomain(domain string) bool + func Load(path string) + func LoadFS(fsys fs.FS) + func Locale() string + func Locales() []string + func Match(supported []string, userAccept []string) (tag language.Tag, index int, c language.Confidence) + func MatchTag(supportedTags []language.Tag, userAcceptTags []language.Tag) (tag language.Tag, index int, c language.Confidence) + func MostMatchLocale() string + func N(msgID, msgIDPlural string, n int, args ...interface{}) string + func N64(msgID, msgIDPlural string, n int64, args ...interface{}) string + func SetCtxDomain(ctx context.Context, domain string) context.Context + func SetCtxLocale(ctx context.Context, lang string) context.Context + func SetDomain(domain string) + func SetGlobal(g *Translations) + func SetLocale(locale string) + func SetSourceCodeLocale(locale string) + func SourceCodeLocale() string + func T(msgID string, args ...interface{}) string + func Tag(locale string) language.Tag + func Tags(locales []string) (tags []language.Tag) + func UsedLocale() string + func WithCookieName(cookieName string) getUserLangOpt + func X(msgCtxt, msgID string, args ...interface{}) string + func XN(msgCtxt, msgID, msgIDPlural string, n int, args ...interface{}) string + func XN64(msgCtxt, msgID, msgIDPlural string, n int64, args ...interface{}) string + type Translation struct + func NewTranslation(domain string, translators ...Translator) *Translation + func (tr *Translation) AddOrReplace(tor Translator) Translator + func (tr *Translation) Get(lang string) (Translator, bool) + func (tr *Translation) GetOrNoop(lang string) Translator + func (tr *Translation) LoadFS(f fs.FS) bool + func (tr *Translation) LoadFile(file fs.File) error + func (tr *Translation) LoadMo(content []byte) error + func (tr *Translation) LoadPo(content []byte) error + type Translations struct + func D(domain string) *Translations + func Global() *Translations + func L(locale string) *Translations + func NewTranslations() *Translations + func WithContext(ctx context.Context) *Translations + func (ts *Translations) BindFS(domain string, fsys fs.FS) + func (ts *Translations) D(domain string) *Translations + func (ts *Translations) Domain() string + func (ts *Translations) Domains() (domains []string) + func (ts *Translations) Get(domain string) (*Translation, bool) + func (ts *Translations) GetOrNoop(domain string) *Translation + func (ts *Translations) HN(msgID, msgIDPlural string, n int, args ...interface{}) template.HTML + func (ts *Translations) HN64(msgID, msgIDPlural string, n int64, args ...interface{}) template.HTML + func (ts *Translations) HT(msgID string, args ...interface{}) template.HTML + func (ts *Translations) HX(msgCtxt, msgID string, args ...interface{}) template.HTML + func (ts *Translations) HXN(msgCtxt, msgID, msgIDPlural string, n int, args ...interface{}) template.HTML + func (ts *Translations) HXN64(msgCtxt, msgID, msgIDPlural string, n int64, args ...interface{}) template.HTML + func (ts *Translations) HasDomain(domain string) bool + func (ts *Translations) L(locale string) *Translations + func (ts *Translations) Locale() string + func (ts *Translations) Locales() (locales []string) + func (ts *Translations) MostMatchLocale() string + func (ts *Translations) N(msgID, msgIDPlural string, n int, args ...interface{}) string + func (ts *Translations) N64(msgID, msgIDPlural string, n int64, args ...interface{}) string + func (ts *Translations) SetDomain(domain string) + func (ts *Translations) SetLocale(lang string) + func (ts *Translations) SetSourceCodeLocale(lang string) + func (ts *Translations) SourceCodeLocale() string + func (ts *Translations) T(msgID string, args ...interface{}) string + func (ts *Translations) UsedLocale() string + func (ts *Translations) X(msgCtxt, msgID string, args ...interface{}) string + func (ts *Translations) XN(msgCtxt, msgID, msgIDPlural string, n int, args ...interface{}) string + func (ts *Translations) XN64(msgCtxt, msgID, msgIDPlural string, n int64, args ...interface{}) string + type Translator = translator.Translator + func NoopTranslator() Translator