2018-10-04 05:18:36 +03:00
|
|
|
import React from 'react';
|
2019-07-18 11:10:34 +03:00
|
|
|
import { Provider, connect } from 'react-redux';
|
2019-07-17 00:31:34 +03:00
|
|
|
import { PersistGate } from 'redux-persist/integration/react';
|
2019-07-19 19:14:41 +03:00
|
|
|
import { IntlProvider, addLocaleData } from 'react-intl';
|
|
|
|
|
|
|
|
import en from 'react-intl/locale-data/en';
|
|
|
|
import id from 'react-intl/locale-data/id';
|
|
|
|
import ru from 'react-intl/locale-data/ru';
|
|
|
|
import de from 'react-intl/locale-data/de';
|
|
|
|
import it from 'react-intl/locale-data/it';
|
|
|
|
import hu from 'react-intl/locale-data/hu';
|
|
|
|
import tr from 'react-intl/locale-data/tr';
|
|
|
|
import ko from 'react-intl/locale-data/ko';
|
|
|
|
import lt from 'react-intl/locale-data/lt';
|
|
|
|
import pt from 'react-intl/locale-data/pt';
|
|
|
|
import fa from 'react-intl/locale-data/fa';
|
2019-07-18 11:10:34 +03:00
|
|
|
|
|
|
|
import { flattenMessages } from './utils/flattenMessages';
|
|
|
|
import messages from './config/locales';
|
2018-10-04 05:18:36 +03:00
|
|
|
|
2019-07-11 15:33:42 +03:00
|
|
|
import Application from './screens/application';
|
2019-07-17 00:31:34 +03:00
|
|
|
import { store, persistor } from './redux/store/store';
|
2018-11-14 17:29:29 +03:00
|
|
|
|
2019-07-19 19:14:41 +03:00
|
|
|
addLocaleData([...en, ...ru, ...de, ...id, ...it, ...hu, ...tr, ...ko, ...pt, ...lt, ...fa]);
|
|
|
|
|
2019-07-18 11:10:34 +03:00
|
|
|
const _renderApp = ({ locale }) => (
|
|
|
|
<PersistGate loading={null} persistor={persistor}>
|
|
|
|
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
|
2019-07-17 00:31:34 +03:00
|
|
|
<Application />
|
2019-07-18 11:10:34 +03:00
|
|
|
</IntlProvider>
|
|
|
|
</PersistGate>
|
2018-10-04 05:18:36 +03:00
|
|
|
);
|
2019-07-18 11:10:34 +03:00
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
locale: state.application.language,
|
|
|
|
});
|
|
|
|
|
|
|
|
const App = connect(mapStateToProps)(_renderApp);
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
|
|
|
<App />
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|