Documentation
¶
Index ¶
- Variables
- func InitLocales(ctx context.Context)
- func Match(tags ...language.Tag) language.Tag
- type LangType
- type Locale
- type MockLocale
- func (l MockLocale) Language() string
- func (l MockLocale) PrettyNumber(v any) string
- func (l MockLocale) Tr(format string, args ...any) (ret template.HTML)
- func (l MockLocale) TrN(cnt any, key1, keyN string, args ...any) template.HTML
- func (l MockLocale) TrString(format string, args ...any) (ret string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey any = &contextKey{}
Functions ¶
Types ¶
type LangType ¶
type LangType struct {
Lang, Name string // these fields are used directly in templates: {{range .AllLangs}}{{.Lang}}{{.Name}}{{end}}
}
LangType represents a lang type
type Locale ¶
type Locale interface {
Language() string
TrString(string, ...any) string
Tr(key string, args ...any) template.HTML
TrN(cnt any, key1, keyN string, args ...any) template.HTML
PrettyNumber(v any) string
}
Locale represents an interface to translation
type MockLocale ¶
type MockLocale struct {
Lang, LangName string // these fields are used directly in templates: ctx.Locale.Lang
}
MockLocale provides a mocked locale without any translations
func (MockLocale) Language ¶
func (l MockLocale) Language() string
func (MockLocale) PrettyNumber ¶
func (l MockLocale) PrettyNumber(v any) string
Click to show internal directories.
Click to hide internal directories.