Documentation ¶
Index ¶
- func GetSupportedLang(lang string) string
- func GetSupportedLanguages() []string
- func NewBundle() *i18n.Bundle
- func NewLocalizer(lang, accept string) *i18n.Localizer
- func SetBody(c *context.Context, body gin.H, translations map[string]string) gin.H
- func SetLang(c *context.Context, lang string) *context.Context
- func Translate(c *context.Context, id string) string
- func TranslateNestedItem(c *context.Context, nestedKey, id string) string
- func TranslatePageFull(c *context.Context, nestedKey string) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSupportedLang ¶
GetSupportedLang is a helper to check if language passed is supported by system
func GetSupportedLanguages ¶
func GetSupportedLanguages() []string
GetSupportedLanguages get all system suported laguages codes
func NewBundle ¶
NewBundle create a singleton instance of *i18n.Bundle, who know where to look and find the translation files
func NewLocalizer ¶
NewLocalizer create a new i18n localizer
func Translate ¶
Translate is a shortcut for `c.Localizer.Localize(&i18n.LocalizeConfig{MessageID: id})` and also treat errors with default message
func TranslateNestedItem ¶
TranslateNestedItem is a shortcut for `Translate(c, fmt.Sprintf("%s.%s", nestedKey, id))`
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.