From 159953050a9c4fb700bbde79042ead4843b0bea5 Mon Sep 17 00:00:00 2001
From: enahum <nahumhbl@gmail.com>
Date: Thu, 2 Jun 2016 16:47:26 -0300
Subject: PLT-1800 Load server side locale from the config.json (#3202)

* PLT-1800 Load server side locale from the config.json

* Add support for locales with country specifics

* Fix localization on served locale file as plain/text

* Remove github.com/cloudfoundry/jibber_jabber as vendor dependency

* Fix get locale on login_controller
---
 webapp/components/user_settings/user_settings_display.jsx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'webapp/components/user_settings/user_settings_display.jsx')

diff --git a/webapp/components/user_settings/user_settings_display.jsx b/webapp/components/user_settings/user_settings_display.jsx
index a7015d403..7036d7389 100644
--- a/webapp/components/user_settings/user_settings_display.jsx
+++ b/webapp/components/user_settings/user_settings_display.jsx
@@ -641,7 +641,11 @@ export default class UserSettingsDisplay extends React.Component {
             );
         }
 
+        const userLocale = this.props.user.locale;
         if (this.props.activeSection === 'languages') {
+            if (!I18n.isLanguageAvailable(userLocale)) {
+                this.props.user.locale = global.window.mm_config.DefaultClientLocale;
+            }
             languagesSection = (
                 <ManageLanguages
                     user={this.props.user}
@@ -652,7 +656,12 @@ export default class UserSettingsDisplay extends React.Component {
                 />
             );
         } else {
-            var locale = I18n.getLanguageInfo(this.props.user.locale).name;
+            let locale;
+            if (I18n.isLanguageAvailable(userLocale)) {
+                locale = I18n.getLanguageInfo(userLocale).name;
+            } else {
+                locale = I18n.getLanguageInfo(global.window.mm_config.DefaultClientLocale).name;
+            }
 
             languagesSection = (
                 <SettingItemMin
-- 
cgit v1.2.3-1-g7c22

