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

babel-gettext-extractor

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-gettext-extractor

Extract gettext string with babel

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.1K
decreased by-13.63%
Maintainers
2
Weekly downloads
 
Created
Source

babel-gettext-extractor

Extract gettext string with babel support syntax JSX, ES6, ... It is based on node-gettext. This is a fork of the npm module babel-gettext-plugin which adds support for references and runs on earlier versions of node.

Node use

var babel = require("babel");

babel.transform(code, { plugins:["babel-gettext-extractor"]});

Command line use

babel --plugins babel-gettext-extractor code.js

Options

You can pass otions as extra in babel options :

plugins: [
  ['babel-gettext-extractor', {
    headers: <Object>,
    functionNames: <Object>,
    fileName: <String>,
    baseDirectory: <String>
  }]
]

headers

The headers to put in the po file.

headers: {
  "content-type": "text/plain; charset=UTF-8",
  "plural-forms": "nplurals=2; plural=(n!=1);"
}

functionNames

A list of function names to extract. The list is the definition of the parameters: "domain", "msgctxt", "msgid", "msgid_plural" and "count"

example:

functionNames: {
  myfunction: ["msgid"]
}

fileName

The filename where the end result is placed.

baseDirectory

If provided, then file names are chopped off in relation to this base path if filenames start with that path.

License

MIT License.

Keywords

FAQs

Package last updated on 11 Jan 2017

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