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

babel-plugin-transform-format-message

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-format-message

Pre-generate ids from default messages or inline a single language translation

  • 6.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5K
decreased by-29.7%
Maintainers
4
Weekly downloads
 
Created
Source

babel-plugin-transform-format-message

Pre-generate ids from default messages or inline a single language translation

npm Version JS Standard Style MIT License

Installation

$ npm install babel-plugin-transform-format-message

Usage

.babelrc

{
  "plugins": [ "transform-format-message", {
    "generateId": "underscored_crc32",
    "inline": false
  } ]
}

Via CLI

$ babel --plugins transform-format-message script.js

Via Node API

require("babel-core").transform("code", {
  plugins: [
    [ "transform-format-message", {
      "generateId": "underscored_crc32",
      "translations": "./locales",
      "locale": "pt-BR"
    } ]
  ]
})

Options

  • generateId is either a function string -> string, or one of "literal", "normalized", "underscored", "underscored_crc32". Default is "underscored_crc32".
  • inline is a boolean. If true, the full translated message will be inlined and optimized, otherwise only generated ids will be added. Default is false.
  • locale is the BCP 47 Language Tag string specifying the target language to inline. This is only used with inline: true. Default is "en".
  • translations is an object of the form: { [locale]: { [id]: { message: '...' }, ... } }. This is an object with keys for each locale, with values matching the extract-format-message json output. This can also be a string path to require a module that exports a matching object.
  • missingTranslation is one of "ignore", "warning", "error". Default is "warning".
  • missingReplacement is an optional string to use in place of missing translations. By default the default message will be used.

License

This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

Keywords

FAQs

Package last updated on 17 Feb 2022

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