webpack-config-intl
Add support for intl to your webpack build.
Usage
Install:
npm install --save webpack-config-intl
Add to your webpack.config.babel.js
:
; // Optional messagesDir config option specifying the location of yaml message// files. /* existing webpack configuration */
Load intl data and messages dynamically in your app:
// intl.action.js; const loadLocale = Promiseall ;
// intl.reducer.jsconst initialState = messages: {} locale: processenvDEFAULT_LOCALE; { };
Provide the loaded intl data to your components:
import createElement from 'react';import setDisplayName from 'recompose/setDisplayName';import connect from 'react-redux';import IntlProvider from 'react-intl'; const App = locale messages children ...props <IntlProvider // , // . `` // . = = = = = > // ... </IntlProvider> const mapState = state locale: stateintllocale messages: stateintlmessages); mapState nullApp;