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
Via .babelrc
(Recommended)
.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 adescription
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 };