Documentation ¶
Index ¶
Constants ¶
const ( EN = "en" FA = "fa" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Translator ¶
type Translator interface { Translate(language string, messageID string) string TranslateEN(messageID string) string TranslateFA(messageID string) string }
func New ¶
func New(address string, defaultLanguage language.Tag, languages ...language.Tag) (Translator, error)
Initialization of the translation.
You can get your language Tag with using "golang.org/x/text/language" library like: language.English
If `address` == "", on linux we will set address to "build/translations" and on windows address is "build\translations\"
type TranslatorPack ¶
type TranslatorPack struct {
// contains filtered or unexported fields
}
func (*TranslatorPack) Translate ¶
func (translator *TranslatorPack) Translate(language string, messageID string) string
Translates to requested language and if only the language is not added before with `loadLanguages` or `Setup` functions, `localizer not found` error returns.
You can get your language string code with using "golang.org/x/text/language" library like: language.English.String()
func (*TranslatorPack) TranslateEN ¶
func (translator *TranslatorPack) TranslateEN(messageID string) string
Translates to English and if only the language is not added before with `loadLanguages` or `Setup` functions, `localizer not found` error returns.
You can get your language string code with using "golang.org/x/text/language" library like: language.English.String()
func (*TranslatorPack) TranslateFA ¶
func (translator *TranslatorPack) TranslateFA(messageID string) string
Translates to English and if only the language is not added before with `loadLanguages` or `Setup` functions, `localizer not found` error returns.
You can get your language string code with using "golang.org/x/text/language" library like: language.English.String()