# jsxgettext

> Extracts gettext strings from JavaScript, EJS, Pug, Jinja and Handlebars files.

Latest version **0.11.0** (published 2018-09-25) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install jsxgettext
pnpm add jsxgettext
yarn add jsxgettext
bun add jsxgettext
```

Provides the command `jsxgettext`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.0 |
| Published | 2018-09-25 |
| First published | 2012-07-06 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0.0 |
| Dependencies | 7 |
| Unpacked size | 42.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 105 |
| Author | Zach Carter |
| Maintainers | 6a68, byk, fmarier, ozten, seanmonstar, stomlinson, zaach |
| Keywords | i18n, internationalization, gettext, xgettext |

## Links

- npm: https://www.npmjs.com/package/jsxgettext
- Repository: https://github.com/zaach/jsxgettext
- Issues: https://github.com/zaach/jsxgettext/issues
- npm.io page: https://npm.io/package/jsxgettext

## Dependencies (7)

- [acorn](https://npm.io/package/acorn.md) ^5.1.2
- [acorn-jsx](https://npm.io/package/acorn-jsx.md) ^4.0.1
- [commander](https://npm.io/package/commander.md) ^2.11.0
- [pug-lexer](https://npm.io/package/pug-lexer.md) ^4.0.0
- [pug-parser](https://npm.io/package/pug-parser.md) ^5.0.0
- [gettext-parser](https://npm.io/package/gettext-parser.md) ^2.0.0
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^1.0.5

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.11.0 (latest) — 2018-09-25
- 0.10.2 — 2017-03-28
- 0.9.0 — 2016-04-21
- 0.8.2 — 2016-01-09
- 0.8.1 — 2015-07-27
- 0.8.0 — 2015-06-18
- 0.7.0 — 2015-04-07
- 0.6.3 — 2015-03-16
- 0.6.2 — 2015-02-13
- 0.6.1 — 2014-11-12
- 0.6.0 — 2014-11-07
- 0.5.4 — 2014-11-05
- 0.5.3 — 2014-10-07
- 0.5.2 — 2014-10-06
- 0.5.1 — 2014-10-04
- … 36 more at https://npm.io/package/jsxgettext/versions

## README

# jsxgettext [![Build Status](https://travis-ci.org/zaach/jsxgettext.png)](https://travis-ci.org/zaach/jsxgettext) [![NPM version](https://badge.fury.io/js/jsxgettext.png)](http://badge.fury.io/js/jsxgettext)

A node module with a CLI that extracts gettext strings from JavaScript, EJS, Jade, Jinja, Swig and Handlebars files. Uses a real parser, [acorn](https://github.com/marijnh/acorn), for JavaScript files and recognizes the following uses:

```javascript
gettext("Hello world!");
gettext("Hello " + 'world!');
myModule.gettext("Hello " + 'world!');
gettext.call(myObj, "Hello " + 'world!');
ngettext("Here's an apple for you", "Here are %s apples for you", 3);
ngettext("Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
myModule.ngettext("Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
ngettext.call(myObj, "Here's an apple" + ' for you', "Here are %s apples" + ' for you', 3);
```

It also extracts comments that begin with "L10n:" when they appear above or next to a `gettext` call:

```javascript
// L10n: Don't forget the exclamation mark
gettext("Hello world!");  // L10n: Salutation to the world
```

"L10n:" is a default value and you can change it with `-c` option.

## Install

    npm install jsxgettext

Or from source:

    git clone https://github.com/zaach/jsxgettext.git
    cd jsxgettext
    npm link

## Use

    $ jsxgettext -h


    Usage: cli [options] [file ...]

    Options:

      -h, --help                         output usage information
      -V, --version                      output the version number
      -o, --output <file>                write output to specified <file>
      -p, --output-dir <path>            output files will be placed in directory <path>
      -k, --keyword [keywords]           additional keywords to be looked for
      -j, --join-existing                join messages with existing file
      -L, --language [lang]              use the specified language (javascript, ejs, jinja, handlebars, pug, swig) [javascript]
      -s, --sanity                       sanity check during the extraction
      --project-id-version [version]     This is the project name and version of the generated package/catalog.
      --report-bugs-to [bug address]     An email address or URL where you can report bugs in the untranslated strings.
      -c, --add-comments [tag]           place comment blocks starting with TAG and preceding keyword lines in output file (default: "L10n:").
      --parser-options [parser options]  A json to customize acorn parser.

---
_Source: https://npm.io/package/jsxgettext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
