Documentation ¶
Index ¶
- Constants
- Variables
- func NewErrTranslating(s string) errTranslating
- func SetStructLanguage(data interface{}, lang string) error
- type I18nField
- func (s *I18nField) GetBSON() (interface{}, error)
- func (s *I18nField) GetTranslation(lang string) (string, error)
- func (s *I18nField) MarshalJSON() ([]byte, error)
- func (s *I18nField) SetBSON(raw bson.Raw) error
- func (s *I18nField) SetTranslation(lang, txt string)
- func (s *I18nField) String() string
- func (s *I18nField) UnmarshallJSON(b []byte) error
- type Translations
Constants ¶
View Source
const TagName string = "translate"
Variables ¶
View Source
var ( LANG string ErrNotPointer = errors.New("Output is not a pointer.") ErrNotStruct = errors.New("Data is not a struct") ErrTranslating = NewErrTranslating("Error while translating") ErrWrongType = errors.New("Tag \"translate\" used on a field which is not of type I18nString") )
Functions ¶
func NewErrTranslating ¶
func NewErrTranslating(s string) errTranslating
func SetStructLanguage ¶
Types ¶
type I18nField ¶
type I18nField struct { Default string L string M Translations }
func NewI18nField ¶
func NewI18nField(s string, t Translations) I18nField
func (*I18nField) MarshalJSON ¶
func (*I18nField) SetTranslation ¶
func (*I18nField) UnmarshallJSON ¶
type Translations ¶
Click to show internal directories.
Click to hide internal directories.