From ec7a273550a1aaf31e80abc90c99d06a94664b5d Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Fri, 27 May 2016 09:01:35 -0400
Subject: Revert "PLT-1800 Load server side locale from the config.json"
 (#3133)

---
 webapp/actions/global_actions.jsx | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

(limited to 'webapp/actions/global_actions.jsx')

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);
-- 
cgit v1.2.3-1-g7c22

