Documentation ¶
Index ¶
- Constants
- func CurrentLang() string
- func DefaultLang() string
- func FillObject(spec interface{}) error
- func Load(c Config) error
- func SetCurrentLang(lang string) error
- func SetDefaultLang(lang string) error
- func Translate(key string) string
- type Config
- type CurrentLanguageTagNotExistsError
- type InvalidSpecificationError
- type LanguageFileNotFoundError
- type LanguageNotFoundError
- type LanguagesNotInitializedError
Constants ¶
const (
NotInitialized = "..::-@#@-::.."
)
Variables ¶
This section is empty.
Functions ¶
func FillObject ¶ added in v0.2.1
func FillObject(spec interface{}) error
FillObject maps each of the object's properties with its corresponding translation key specified in the i18n tag. Example:
type Person struct { Name string `i18n:"Person.Name"` State string `i18n:"StateLabel"` }
func SetCurrentLang ¶
SetCurrentLang set a language loaded in memory to use
func SetDefaultLang ¶
SetDefaultLang set a language loaded in memory as default
Types ¶
type CurrentLanguageTagNotExistsError ¶
type CurrentLanguageTagNotExistsError struct{}
CurrentLanguageTagNotExistsError occurs when current language tag not exists in memory
func (*CurrentLanguageTagNotExistsError) Error ¶
func (e *CurrentLanguageTagNotExistsError) Error() string
Error return error message
type InvalidSpecificationError ¶ added in v0.2.1
type InvalidSpecificationError struct{}
InvalidSpecificationError occurs when the specification is not a structure pointer or one of its properties is not of type string
func (*InvalidSpecificationError) Error ¶ added in v0.2.1
func (e *InvalidSpecificationError) Error() string
Error return error message
type LanguageFileNotFoundError ¶
type LanguageFileNotFoundError struct{}
LanguageFileNotFoundError occurs when not language files are found in the directory
func (*LanguageFileNotFoundError) Error ¶
func (e *LanguageFileNotFoundError) Error() string
Error return error message
type LanguageNotFoundError ¶
type LanguageNotFoundError struct{}
LanguageNotFoundError occurs when not language is found in memory
func (*LanguageNotFoundError) Error ¶
func (e *LanguageNotFoundError) Error() string
Error return error message
type LanguagesNotInitializedError ¶
type LanguagesNotInitializedError struct{}
LanguagesNotInitializedError occurs when the languages are not initialized
func (*LanguagesNotInitializedError) Error ¶
func (e *LanguagesNotInitializedError) Error() string
Error return error message