@twoday/react-intl-bundled-messages
v1.4.0
Published
`IntlProvider` that lazy loads messages in current language in Webpack environment.
Downloads
5
Readme
@twoday/react-intl-bundled-messages
IntlProvider
that lazy loads messages in current language in Webpack environment.
Usage
Bundled messages
Add module resolve alias. In Webpack config:
import bundledMessagesWebpackAlias from "@twoday/react-intl-bundled-messages/lib/webpackAlias.js"; export default { //... resolve: { alias: { ...bundledMessagesWebpackAlias(mode), }, }, };
Build messages using @twoday/formatjs-scripts
Add
IntlProvider
:import { IntlProvider } from "@twoday/react-intl-bundled-messages"; function App() { return <IntlProvider>...</IntlProvider>; }
Messages from envManifest
Build messages using @twoday/env-public-config-and-messages-scripts
Add
IntlProvider
:import { IntlProvider } from "@twoday/react-intl-bundled-messages"; import envManifest from "./.env-manifest.json"; function App() { return <IntlProvider envManifest={envManifest}>...</IntlProvider>; }