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-intlUsage
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.jsonfile corresponding to each component from which React Intl messages were extracted.enforceDescriptions: Whether or not message declarations must contain adescriptionto provide context to translators.
Via CLI
$ babel --plugins react-intl script.jsVia Node API
require("babel-core").transform("code", {
plugins: ["react-intl"]
}) // => { code, map, ast, metadata['react-intl'].messages };