Documentation ¶
Index ¶
- Variables
- func AddLocale(langName string, validationTranslation *ValidationTranslation, ...)
- func Locale(c *gin.Context) string
- func NewCommonLanguage(langName string) locales.Translator
- func SetLocale(c *gin.Context, locale string)
- func Translate(messageID string, data map[string]interface{}, langName string) string
- func Translator(v *validator.Validate, langName string) (ut.Translator, error)
- type CustomTranslation
- type EmbeddedRule
- type PluralRule
- type UnmarshalFunc
- type ValidationTranslation
- type ValidationTranslator
Constants ¶
This section is empty.
Variables ¶
View Source
var LocalizerMap map[string]*i18n.Localizer
Functions ¶
func AddLocale ¶
func AddLocale(langName string, validationTranslation *ValidationTranslation, customTranslation *CustomTranslation)
func NewCommonLanguage ¶
func NewCommonLanguage(langName string) locales.Translator
New returns a new instance of translator for the 'commonLang' locale
func Translator ¶
Types ¶
type CustomTranslation ¶ added in v0.3.0
UnmarshalFunc func(data []byte, v interface{}) error
type EmbeddedRule ¶ added in v0.3.0
type PluralRule ¶ added in v0.3.0
type UnmarshalFunc ¶
type UnmarshalFunc = i18n.UnmarshalFunc
type ValidationTranslation ¶ added in v0.3.0
type ValidationTranslation struct { Required string Len EmbeddedRule Min EmbeddedRule Max EmbeddedRule Eq string Ne string Lt EmbeddedRule Lte EmbeddedRule Gt EmbeddedRule Gte EmbeddedRule Eqfield string Eqcsfield string Necsfield string Gtcsfield string Gtecsfield string Ltcsfield string Ltecsfield string Nefield string Gtfield string Gtefield string Ltfield string Ltefield string Alpha string Alphanum string Numeric string Number string Hexadecimal string Hexcolor string Rgb string Rgba string Hsl string Hsla string Email string Url string Uri string Base64 string Contains string Containsany string Excludes string Excludesall string Excludesrune string Isbn string Isbn10 string Isbn13 string Uuid string Uuid3 string Uuid4 string Uuid5 string Ascii string Printascii string Multibyte string Datauri string Latitude string Longitude string Ssn string Ipv4 string Ipv6 string Ip string Cidr string Cidrv4 string Cidrv6 string TcpAddr string Tcp4Addr string Tcp6Addr string UdpAddr string Udp4Addr string Udp6Addr string IpAddr string Ip4Addr string Ip6Addr string UnixAddr string Mac string Unique string Iscolor string Oneof string PluralRuleMap map[string]PluralRule }
type ValidationTranslator ¶
type ValidationTranslator interface { RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (err error) Locale() string LocalesTranslator() locales.Translator }
Click to show internal directories.
Click to hide internal directories.