Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Router, Route } from 'react-router';
import { Provider, connect } from 'react-redux';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import * as components from '../components/index';
import * as i18n from './i18n/index';
import * as storage from './storage';
import * as reducers from './reducers';
import { C } from './core';
// locale information for react-intl
import en from 'react-intl/dist/locale-data/en';
import es from 'react-intl/dist/locale-data/es';
import fr from 'react-intl/dist/locale-data/fr';
import de from 'react-intl/dist/locale-data/de';
addLocaleData(en);
addLocaleData(es);
addLocaleData(fr);
addLocaleData(de);
const {
Header,
DOMHelper,
MainPanel
} = components;
// initialize the store with the appropriate lang
const store = initStore({ locale: storage.get('locale') || C.DEFAULT_LOCALE });
// debugging
//console.log("initial store state: ", store.getState());
//store.subscribe(() => console.log("store just changed: ", store.getState()));
export default function loadLocaleData(localeCode: ?string) {
if (!localeCode) {
return;
}
const locale = localeMap[localeCode];
if (!locale) {
console.warn(`${localeCode} not supported`);
return;
}
if (!locale.data) {
// locale is supported but no special config will be loaded
return;
}
addLocaleData(locale.data);
}
import {Col, Row} from 'react-bootstrap';
import {IfPermitted, PageHeader, Spinner, DocumentTitle} from 'components/common';
import AlertRuleList from './AlertRuleList';
import ManageSettings from './ManageSettings';
import {addLocaleData, IntlProvider, FormattedMessage} from 'react-intl';
import messages_fr from '../translations/fr.json';
import WizardConfigurationsActions from '../config/WizardConfigurationsActions';
import WizardConfigurationStore from "../config/WizardConfigurationsStore";
import StoreProvider from 'injection/StoreProvider';
import ActionsProvider from 'injection/ActionsProvider';
const PluginsStore = StoreProvider.getStore('Plugins');
const NodesActions = ActionsProvider.getActions('Nodes');
let frLocaleData = require('react-intl/locale-data/fr');
const language = navigator.language.split(/[-_]/)[0];
addLocaleData(frLocaleData);
const messages = {
'fr': messages_fr
};
const WizardPage = createReactClass({
displayName: 'WizardPage',
mixins: [Reflux.connect(WizardConfigurationStore)],
getInitialState() {
return {
configurations: null,
version: '',
};
},
}).catch(error => {
addLocaleData(require('react-intl/locale-data/en'));
let defaultLocale = Axios.create({
baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/"
+ Constants.defaultLocale + ".json"
}).get();
defaultLocale.then(response => {
const messages = defineMessages(response.data);
ReactDOM.render(, document.getElementById('root'));
registerServiceWorker();
}).catch(error => {
});
});
}
import { addLocaleData } from 'react-intl';
import Enlang from './entries/en-US';
import Zhlang from './entries/zh-Hans-CN';
import Krlang from './entries/ko-KR';
addLocaleData(Enlang.data);
addLocaleData(Zhlang.data);
addLocaleData(Krlang.data);
export default {
[Enlang.locale]: Enlang,
[Zhlang.locale]: Zhlang,
[Krlang.locale]: Krlang,
};
import addressbook from './addressbook';
import terminal from './terminal';
import settings from './settings';
import intl from './intl';
import { addLocaleData } from 'react-intl';
import ru from 'react-intl/locale-data/ru';
import ja from 'react-intl/locale-data/ja';
import de from 'react-intl/locale-data/de';
import en from 'react-intl/locale-data/en';
import ko from 'react-intl/locale-data/ko';
import fr from 'react-intl/locale-data/fr';
import es from 'react-intl/locale-data/es';
import { FormattedMessage } from 'react-intl';
addLocaleData(ru);
addLocaleData(en);
addLocaleData(ja);
addLocaleData(de);
addLocaleData(ko);
addLocaleData(fr);
addLocaleData(es);
export default function createRootReducer(history: {}) {
const routerReducer = connectRouter(history)(() => {});
return connectRouter(history)(
combineReducers({
intl,
overview,
routerReducer,
list,
import * as React from 'react';
import ReactDOM from 'react-dom';
import {addLocaleData, IntlProvider} from 'react-intl';
import enLocaleData from 'react-intl/locale-data/en';
import App from './components/app';
addLocaleData(enLocaleData);
const {locale, messages} = window.App;
ReactDOM.render(
messages[namespace]} />
,
document.getElementById('container')
);
import jaLocaleData from 'react-intl/locale-data/ja'
import enLocaleData from 'react-intl/locale-data/en'
import zhLocaleData from 'react-intl/locale-data/zh'
import idLocaleData from 'react-intl/locale-data/id'
import zhtwLocaleData from './localedata-zhtw'
import enTranslationMessages from './en.yml'
import idTranslationMessages from './id.yml'
import jaTranslationMessages from './ja.yml'
import zhTranslationMessages from './zh.yml'
import zhtwTranslationMessages from './zh-TW.yml'
addLocaleData(enLocaleData)
addLocaleData(idLocaleData)
addLocaleData(jaLocaleData)
addLocaleData(zhLocaleData)
addLocaleData(zhtwLocaleData)
export const appLocales = ['en', 'id', 'ja', 'zh', 'zh-tw']
export const translationMessages = {
en: enTranslationMessages,
id: idTranslationMessages,
ja: jaTranslationMessages,
zh: zhTranslationMessages,
'zh-tw': zhtwTranslationMessages,
}
Object.keys(window.ReactIntlLocaleData).forEach(lang => {
addLocaleData(window.ReactIntlLocaleData[lang])
})
}