2020-07-04 12:54:35 +02:00
|
|
|
package i18n
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
type Language string
|
|
|
|
|
|
|
|
type LanguageMap map[Language]MessageMap
|
|
|
|
|
|
|
|
const (
|
2020-07-07 10:51:55 +02:00
|
|
|
German Language = "de"
|
|
|
|
English Language = "en"
|
|
|
|
Spanish Language = "es"
|
|
|
|
French Language = "fr"
|
|
|
|
Dutch Language = "nl"
|
2020-07-08 08:19:29 +02:00
|
|
|
Polish Language = "pl"
|
2020-07-07 10:51:55 +02:00
|
|
|
Portuguese Language = "pt"
|
|
|
|
Russian Language = "ru"
|
|
|
|
Chinese Language = "zh"
|
|
|
|
Default = English
|
2020-07-04 12:54:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var Languages = LanguageMap{
|
2020-07-07 10:51:55 +02:00
|
|
|
German: MsgGerman,
|
|
|
|
English: MsgEnglish,
|
|
|
|
Spanish: MsgSpanish,
|
|
|
|
French: MsgFrench,
|
|
|
|
Dutch: MsgDutch,
|
2020-07-08 08:19:29 +02:00
|
|
|
Polish: MsgPolish,
|
2020-07-07 10:51:55 +02:00
|
|
|
Portuguese: MsgPortuguese,
|
|
|
|
Russian: MsgRussian,
|
|
|
|
Chinese: MsgChinese,
|
2020-07-04 12:54:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var Lang = Default
|
|
|
|
|
|
|
|
func SetLang(s string) {
|
|
|
|
if len(s) != 2 {
|
|
|
|
Lang = Default
|
|
|
|
} else {
|
|
|
|
s = strings.ToLower(s)
|
|
|
|
Lang = Language(s)
|
|
|
|
}
|
|
|
|
}
|