JSPM

  • Created
  • Published
  • Downloads 100542
  • Score
    100M100P100Q49124F
  • License BSD-3-Clause

Extracts string messages from modules that use react-intl.

Package Exports

  • babel-plugin-react-intl
  • babel-plugin-react-intl/lib/print-icu-message

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-react-intl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-react-intl

THIS IS A PREVIEW RELEASE THAT WORKS WITH A FUTURE, UNRELEASED VERSION OF REACT INTL.

Extracts string messages from React components that use React Intl.

Installation

$ npm install babel-plugin-react-intl

Usage

.babelrc

{
  "plugins": ["react-intl"],
  "extra": {
    "react-intl": {
        "messagesDir": "./build/messages/",
        "enforceDescriptions": true
    }
  }
}

Options

  • messagesDir: The target location where the plugin will output a .json file corresponding to each component from which React Intl messages were extracted.

  • enforceDescriptions: Whether or not message declarations must contain a description to provide context to translators.

Via CLI

$ babel --plugins react-intl script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["react-intl"]
}) // => { code, map, ast, metadata['react-intl'].messages };