HelloWorldApp.jsx 1.14 KB
Newer Older
1 2 3
import React from 'react';
import { Provider } from 'react-redux';
import { IntlProvider, addLocaleData } from 'react-intl';
4
import ar from 'react-intl/locale-data/ar'
5
import de from 'react-intl/locale-data/de';
6
import en from 'react-intl/locale-data/en';
7 8 9
import ja from 'react-intl/locale-data/ja';
import { defaultLocale } from '../../../locales/default';
import { translations } from '../../../locales/translations';
10 11 12
import configureStore from '../store/helloWorldStore';
import HelloWorldContainer from '../containers/HelloWorldContainer';

13
addLocaleData([
14
  ...ar,
15
  ...de,
16
  ...en,
17 18
  ...ja,
]);
19 20 21

const locale   = document.documentElement.lang || defaultLocale;
const messages = translations[locale] || translations[defaultLocale];
22 23 24 25

// See documentation for https://github.com/reactjs/react-redux.
// This is how you get props from the Rails view into the redux store.
// This code here binds your smart component to the redux store.
Yamagishi Kazutoshi's avatar
Yamagishi Kazutoshi committed
26
const HelloWorldApp = props => (
27
  <IntlProvider locale={locale} messages={messages}>
28 29 30 31 32 33 34
    <Provider store={configureStore(props)}>
      <HelloWorldContainer />
    </Provider>
  </IntlProvider>
);

export default HelloWorldApp;