From b00a60ab71b2bd4640c8608d71805ba9caae97d9 Mon Sep 17 00:00:00 2001 From: enahum Date: Wed, 1 Jun 2016 09:56:13 -0300 Subject: PLT-1800 Load server side locale from the config.json (#3135) * 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 --- webapp/components/root.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'webapp/components/root.jsx') diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx index c96499392..abaa05bb5 100644 --- a/webapp/components/root.jsx +++ b/webapp/components/root.jsx @@ -6,6 +6,7 @@ import * as GlobalActions from 'actions/global_actions.jsx'; import LocalizationStore from 'stores/localization_store.jsx'; +import Client from 'utils/web_client.jsx'; import {IntlProvider} from 'react-intl'; @@ -41,7 +42,10 @@ export default class Root extends React.Component { FastClick.attach(document.body); } localizationChanged() { - this.setState({locale: LocalizationStore.getLocale(), translations: LocalizationStore.getTranslations()}); + const locale = LocalizationStore.getLocale(); + + Client.setAcceptLanguage(locale); + this.setState({locale, translations: LocalizationStore.getTranslations()}); } redirectIfNecessary(props) { @@ -67,7 +71,7 @@ export default class Root extends React.Component { LocalizationStore.addChangeListener(this.localizationChanged); // Get our localizaiton - GlobalActions.loadBrowserLocale(); + GlobalActions.loadDefaultLocale(); } componentWillUnmount() { LocalizationStore.removeChangeListener(this.localizationChanged); -- cgit v1.2.3-1-g7c22