Documentation ¶
Index ¶
- func SupportedLanguages(dir http.FileSystem) ([]language.Tag, error)
- type Message
- type Translator
- func (t *Translator) AddMessages(tag language.Tag, messages ...Message) error
- func (t *Translator) Lang(r *http.Request) language.Tag
- func (t *Translator) Localize(id string, args map[string]interface{}, langs ...string) string
- func (t *Translator) LocalizeFromCtx(ctx context.Context, id string, args map[string]interface{}) string
- func (t *Translator) LocalizeFromRequest(r *http.Request, id string, args map[string]interface{}) string
- func (t *Translator) SetLangCookie(w http.ResponseWriter, lang language.Tag)
- func (t *Translator) SetPreferredLanguages(langs ...string)
- func (t *Translator) SupportedLanguages() []language.Tag
- type TranslatorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportedLanguages ¶
func SupportedLanguages(dir http.FileSystem) ([]language.Tag, error)
Types ¶
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
func NewTranslator ¶
func NewTranslator(dir http.FileSystem, config TranslatorConfig) (*Translator, error)
func (*Translator) AddMessages ¶
func (t *Translator) AddMessages(tag language.Tag, messages ...Message) error
func (*Translator) Localize ¶
func (t *Translator) Localize(id string, args map[string]interface{}, langs ...string) string
func (*Translator) LocalizeFromCtx ¶
func (*Translator) LocalizeFromRequest ¶
func (*Translator) SetLangCookie ¶
func (t *Translator) SetLangCookie(w http.ResponseWriter, lang language.Tag)
func (*Translator) SetPreferredLanguages ¶
func (t *Translator) SetPreferredLanguages(langs ...string)
func (*Translator) SupportedLanguages ¶
func (t *Translator) SupportedLanguages() []language.Tag
type TranslatorConfig ¶
Click to show internal directories.
Click to hide internal directories.