Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultTranslatorFunc ¶
func SetDefaultTranslatorFunc(fn TranslateFunc)
SetDefaultTranslatorFunc sets the default translation function.
Types ¶
type BaseTranslatableRule ¶
type BaseTranslatableRule struct {
Translate TranslateFunc
Locale string
}
BaseTranslatableRule is a semi-abstract struct that do the basic translation functionality.
func (*BaseTranslatableRule) AddLocale ¶
func (b *BaseTranslatableRule) AddLocale(locale string)
AddLocale adds the default locale for translation.
func (*BaseTranslatableRule) AddTranslationFunction ¶
func (b *BaseTranslatableRule) AddTranslationFunction(fn TranslateFunc)
AddTranslationFunction adds the translation function to the base.
type TranslatableRule ¶
type TranslatableRule interface {
AddLocale(locale string)
AddTranslationFunction(fn TranslateFunc)
}
TranslatableRule is an interface for rules that translate the validation error messages.
type TranslateFunc ¶
TranslateFunc is a function type that translate the given key in given locale.
func GetDefaultTranslatorFunc ¶
func GetDefaultTranslatorFunc() TranslateFunc
GetDefaultTranslatorFunc returns the default translation function.
Click to show internal directories.
Click to hide internal directories.