diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-05-27 09:01:35 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-05-27 09:01:35 -0400 |
commit | ec7a273550a1aaf31e80abc90c99d06a94664b5d (patch) | |
tree | bd0d1080a5ef66b9e7985682919b1c2bd21d4bf1 /webapp/actions | |
parent | a2c183f401bdf8e9abddd35d4561d42034325046 (diff) | |
download | chat-ec7a273550a1aaf31e80abc90c99d06a94664b5d.tar.gz chat-ec7a273550a1aaf31e80abc90c99d06a94664b5d.tar.bz2 chat-ec7a273550a1aaf31e80abc90c99d06a94664b5d.zip |
Revert "PLT-1800 Load server side locale from the config.json" (#3133)
Diffstat (limited to 'webapp/actions')
-rw-r--r-- | webapp/actions/global_actions.jsx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index 93ed7517b..2e2b1b247 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -392,14 +392,9 @@ export function newLocalizationSelected(locale) { translations: en }); } else { - const localeInfo = I18n.getLanguageInfo(locale) || I18n.getLanguageInfo(global.window.mm_config.DefaultClientLocale); - Client.getTranslations( - localeInfo.url, - (data, res) => { - if (!data && res.text) { - data = JSON.parse(res.text); //eslint-disable-line no-param-reassign - } + I18n.getLanguageInfo(locale).url, + (data) => { AppDispatcher.handleServerAction({ type: ActionTypes.RECEIVED_LOCALE, locale, @@ -413,11 +408,10 @@ export function newLocalizationSelected(locale) { } } -export function loadDefaultLocale() { - const defaultLocale = global.window.mm_config.DefaultClientLocale; - let locale = global.window.mm_user ? global.window.mm_user.locale || defaultLocale : defaultLocale; - - if (!I18n.getLanguageInfo(locale)) { +export function loadBrowserLocale() { + let locale = (navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] : + (navigator.language || navigator.userLanguage)).split('-')[0]; + if (!I18n.getLanguages()[locale]) { locale = 'en'; } return newLocalizationSelected(locale); |