New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-intl

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-intl

Extracts string messages for translation from modules that use intl.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
150
decreased by-61.04%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-intl

Extracts string messages for translation from modules that use intl.

Note: This Babel plugin is based on babel-plugin-react-intl and works with Babel 6.

Installation

$ npm install babel-plugin-intl

Usage

This Babel plugin only visits ES6 modules which import intl.

The default message descriptors for the app's default language will be extracted from intl(), which is a default export of the intl package.

.babelrc

{
  "plugins": [
    [
      "intl", {
        "messagesDir": "./build/messages/",
        "enforceDescriptions": false
      }
    ]
  ]
}
Options
  • messagesDir: The target location where the plugin will output a .json file corresponding to each call from which intl messages were extracted. If not provided, the extracted message descriptors will only be accessible via Babel's API.

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

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

Via CLI

$ babel --plugins intl script.js

Via Node API

The extract message descriptors are available via the metadata property on the object returned from Babel's transform() API:

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

Keywords

FAQs

Package last updated on 30 May 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