From 4ae7128ecb66cdddeb9d40a24970c6552814c18b Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Tue, 24 May 2016 10:39:56 -0400
Subject: Revert "PLT-1800 Load server side locale from the config.json
 (#3076)"

This reverts commit 34beaa569bfb32f1607375f1d5a22859322060d2.
---
 webapp/action_creators/global_actions.jsx | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

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

diff --git a/webapp/action_creators/global_actions.jsx b/webapp/action_creators/global_actions.jsx
index 1c2e5ed36..6bb0c1732 100644
--- a/webapp/action_creators/global_actions.jsx
+++ b/webapp/action_creators/global_actions.jsx
@@ -390,10 +390,8 @@ export function newLocalizationSelected(locale) {
             translations: en
         });
     } else {
-        const localeInfo = I18n.getLanguageInfo(locale) || I18n.getLanguageInfo(global.window.mm_config.DefaultClientLocale);
-
         Client.getTranslations(
-            localeInfo.url,
+            I18n.getLanguageInfo(locale).url,
             (data) => {
                 AppDispatcher.handleServerAction({
                     type: ActionTypes.RECEIVED_LOCALE,
@@ -408,11 +406,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

