1.4.0 • Published 1 year ago

@twoday/react-intl-bundled-messages v1.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

@twoday/react-intl-bundled-messages

IntlProvider that lazy loads messages in current language in Webpack environment.

Usage

Bundled messages

  1. Add module resolve alias. In Webpack config:

    import bundledMessagesWebpackAlias from "@twoday/react-intl-bundled-messages/lib/webpackAlias.js";
    
    export default {
      //...
      resolve: {
        alias: {
          ...bundledMessagesWebpackAlias(mode),
        },
      },
    };
  2. Build messages using @twoday/formatjs-scripts

  3. Add IntlProvider:

    import { IntlProvider } from "@twoday/react-intl-bundled-messages";
    
    function App() {
      return <IntlProvider>...</IntlProvider>;
    }

Messages from envManifest

  1. Build messages using @twoday/env-public-config-and-messages-scripts
  2. Add IntlProvider:

    import { IntlProvider } from "@twoday/react-intl-bundled-messages";
    import envManifest from "./.env-manifest.json";
    
    function App() {
      return <IntlProvider envManifest={envManifest}>...</IntlProvider>;
    }