diff options
author | =Corey Hulen <corey@hulen.com> | 2016-01-21 13:54:47 -0600 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-01-21 13:54:47 -0600 |
commit | 8cc45a2e08c3eaaa66619cc7ee9dfc7ff49b388f (patch) | |
tree | b5e95131caef98e33ecd4cce9c573dd4c8e0e4bf /utils/i18n.go | |
parent | dea84b1892be42e8d42db8b67862b56b38c0da75 (diff) | |
parent | a2fa683c1b5fc0c62506e3ac40784b053eda6e3e (diff) | |
download | chat-8cc45a2e08c3eaaa66619cc7ee9dfc7ff49b388f.tar.gz chat-8cc45a2e08c3eaaa66619cc7ee9dfc7ff49b388f.tar.bz2 chat-8cc45a2e08c3eaaa66619cc7ee9dfc7ff49b388f.zip |
Merge branch 'master' into PLT-7-client-infra
Diffstat (limited to 'utils/i18n.go')
-rw-r--r-- | utils/i18n.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/i18n.go b/utils/i18n.go index 4fc8c725a..4b7b187a8 100644 --- a/utils/i18n.go +++ b/utils/i18n.go @@ -36,15 +36,16 @@ func InitTranslations() { func GetTranslationsBySystemLocale() i18n.TranslateFunc { locale := model.DEFAULT_LOCALE if userLanguage, err := jibber_jabber.DetectLanguage(); err == nil { - locale = userLanguage + if _, ok := locales[userLanguage]; ok { + locale = userLanguage + } else { + l4g.Error("Failed to load system translations for '%v' attempting to fall back to '%v'", locale, model.DEFAULT_LOCALE) + locale = model.DEFAULT_LOCALE + } } - if locales[locale] == "" { - l4g.Error("Failed to load system translations for '%v' attempting to fall back to '%v'", locale, model.DEFAULT_LOCALE) - - if locales[model.DEFAULT_LOCALE] == "" { - panic("Failed to load system translations for '" + model.DEFAULT_LOCALE + "'") - } + if locales[model.DEFAULT_LOCALE] == "" { + panic("Failed to load system translations for '" + model.DEFAULT_LOCALE + "'") } translations, _ := i18n.Tfunc(locale) |