photoprism/internal/i18n/lang.go

44 lines
786 B
Go
Raw Normal View History

package i18n
import "strings"
type Language string
type LanguageMap map[Language]MessageMap
const (
German Language = "de"
English Language = "en"
Spanish Language = "es"
French Language = "fr"
Dutch Language = "nl"
Polish Language = "pl"
Portuguese Language = "pt"
Russian Language = "ru"
Chinese Language = "zh"
Default = English
)
var Languages = LanguageMap{
German: MsgGerman,
English: MsgEnglish,
Spanish: MsgSpanish,
French: MsgFrench,
Dutch: MsgDutch,
Polish: MsgPolish,
Portuguese: MsgPortuguese,
Russian: MsgRussian,
Chinese: MsgChinese,
}
var Lang = Default
func SetLang(s string) {
if len(s) != 2 {
Lang = Default
} else {
s = strings.ToLower(s)
Lang = Language(s)
}
}