HelloWorldApp.jsx 1.19 KB
Newer Older
1 2 3
import React from 'react';
import { Provider } from 'react-redux';
import { IntlProvider, addLocaleData } from 'react-intl';
Eugen Rochko's avatar
Eugen Rochko committed
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
import ja from 'react-intl/locale-data/ja';
8
import pl from 'react-intl/locale-data/pl';
9 10
import { defaultLocale } from '../../../locales/default';
import { translations } from '../../../locales/translations';
11 12 13
import configureStore from '../store/helloWorldStore';
import HelloWorldContainer from '../containers/HelloWorldContainer';

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

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

// 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
28
const HelloWorldApp = props => (
29
  <IntlProvider locale={locale} messages={messages}>
30 31 32 33 34 35 36
    <Provider store={configureStore(props)}>
      <HelloWorldContainer />
    </Provider>
  </IntlProvider>
);

export default HelloWorldApp;