Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-react-intl-to-properties

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-intl-to-properties

Extracts string messages for translation from modules that use React Intl into a .properties file.

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

babel-plugin-react-intl-to-properties

Extracts string messages for translation from modules that use React Intl into a .properties file.

Installation

$ npm install babel-plugin-react-intl-to-properties

Example

Formatted Message
  <FormattedMessage
        defaultMessage='React Intl to Properties'
        description='Title for React Intl to Properties'
        id='example.rectintltoprops'
    />
Outputted .properties
# Title for React Intl to Properties
example.rectintltoprops=React Intl to Properties

Usage

The default message descriptors for the app's default language will be extracted from: defineMessages(), <FormattedMessage>, and <FormattedHTMLMeessage>; all of which are named exports of the React Intl package.

.babelrc
{
  "plugins": [
    ["react-intl-to-properties", {
        "enforceDescriptions": true,
        "fileName": "en-US",
        "messagesDir": "./build/messages/"
    }]
  ]
}
Options
  • enforceDescriptions: Whether or not message declarations must contain a description to provide context to translators. Defaults to: false.

  • fileName: Name of the generated .properties file.

  • messagesDir: The target location where the plugin will output a .properties file corresponding to each component from which React Intl messages were extracted. If not provided, the extracted message descriptors will only be accessible via Babel's API.

  • moduleSourceName: The ES6 module source name of the React Intl package. Defaults to: "react-intl", but can be changed to another name/path to React Intl.

  • namespace: Only extract messages with a particular namespaced id in the form <namespace>.id. Useful when including external components with their own messages.

Via CLI
$ babel --plugins react-intl-to-properties script.js

Credit

Forked from yahoo/babel-plugin-react-intl

Keywords

FAQs

Package last updated on 14 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc