Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FieldNameKey = "validation.attributes.%s"
FieldNameKey is the key used to get the field name translation
Functions ¶
func FieldName ¶
func FieldName(trans ut.Translator, fieldName string) string
FieldName returns the translated field name
func LoadTranslate ¶
func LoadTranslate(dir string, uni *ut.UniversalTranslator) error
loads the translations from the .json files in the specified directory
func LoadTranslateFS ¶ added in v0.9.1
func LoadTranslateFS(fsys fs.FS, uni *ut.UniversalTranslator) error
loads the translations from the .json files in the specified directory
Types ¶
type Locale ¶
type Locale struct { Translator locales.Translator ValidateTranslation func(v *validator.Validate, trans ut.Translator) error }
type MapLocales ¶
func (MapLocales) NewUniversalTranslator ¶
func (l MapLocales) NewUniversalTranslator(fallback string) (*ut.UniversalTranslator, error)
returns a new *ut.UniversalTranslator instance
func (MapLocales) RegisterValidateTranslation ¶
func (l MapLocales) RegisterValidateTranslation(v *validator.Validate, uni *ut.UniversalTranslator) error
registers the translations for all locales
Click to show internal directories.
Click to hide internal directories.