@vslutov/jsxgettext-stream
A tool like jsxgettext, but works for es6 + jsx that babel support
Last updated 6 months ago by vslutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @vslutov/jsxgettext-stream 
SYNC missed versions from official npm registry.

@vslutov/jsxgettext-stream

NPM version build status Downloads js-standard-style

A tool like jsxgettext, but works for es6 + jsx that babel support.

Fork of fraserxu/babel-jsxgettext. Improvements:

  • Interface is compatible with gnu xgettext
  • Gulp stream support

Usage

$ npm install @vslutov/jsxgettext-stream --save-dev

Gulp usage

const xgettext = require("@vslutov/jsxgettext-stream")
const poConcat = require("gulp-po-concat")

gulp.task('i18n:pot', () =>
  gulp.src(['src/**/*.js', 'src/**/*.jsx'])
    .pipe(xgettext({plugins: ['flow', 'objectRestSpread']}))
    .pipe(poConcat({domain: 'messages'}))
    .pipe(gulp.dest('src/i18n'))
)

Program API

var parser = require('@vslutov/jsxgettext-stream/parser')

/**
 * The parser function
 * @param  {String}   input  The path to source JavaScript file
 * @param  {String}   plugins Babel parser plugins, separate by `,`
 * @param  {Function} cb     The callback function
 */
const main = async () {
  inputs = input_fnames.map(path => ({ path, contents: fs.readFileSync(path) }))
  const po_contents = await parser(inputs, [])
}

Command line usage

Install globally with npm npm install @vslutov/jsxgettext-stream -g

  A tool like jsxgettext, but works for es6 + jsx that babel support

  Options
    --help                     Show this help
    --version                  Current version of package
    -p | --plugins             String - Babel parser plugins list (`jsx` is always included)'
    -i | --input               String - The path to soure JavaScript file
    -o | --output              String - The path of the output PO file

  Usage
    $ jsxgettext-stream --help
    $ jsxgettext-stream <input> <output>

  Examples
    $ jsxgettext-stream ./test/*.js ./test.po
    $ jsxgettext-stream --plugins "classProperties,objectRestSpread" ./test/*.js test.po

License

MIT

Current Tags

  • 0.6.11                                ...           latest (6 months ago)

12 Versions

  • 0.6.11                                ...           6 months ago
  • 0.6.10                                ...           6 months ago
  • 0.6.9                                ...           2 years ago
  • 0.6.8                                ...           2 years ago
  • 0.6.7                                ...           2 years ago
  • 0.6.6                                ...           2 years ago
  • 0.6.5                                ...           2 years ago
  • 0.6.4                                ...           2 years ago
  • 0.6.3                                ...           2 years ago
  • 0.6.2                                ...           2 years ago
  • 0.6.1                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (7)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |