This package has been deprecated

Author message:

No longer maintained, use `@lingui/cli` instead

react-globe-cli

1.1.1 • Public • Published

💥 Careful: This package is no longer maintained and is only here for historic reasons. This means you should very likely not use it. You have been warned. 💥


react-globe-cli

A CLI tool for extracting a gettext POT file from multiple JS or TS source files using react-globe

Install

npm install react-globe-cli --save

Usage

# Go through all the files and extract the translations into the output file 
react-globe-cli --files='./src/**/*.js' --output='templates.pot'

Note: Make sure you are running this on unminified source code, since it requires the t and tPlural function calls to keep their names. It should be fine with parsing es2015, jsx and TypeScript code, but if you are using bleeding edge (e.g. the stage-0 babel plugin) you will have to pre-compile that.

Example

Input (JS)

// ...
t('Hello World')
// ...
<h1>{t('Sup!')}</h1>
// ...
tPlural({one: 'One potato', many: '{{count}} potatoes'}, {count: 10})

Output (POT)

msgid "Hello World"
msgstr ""
 
msgid "Sup!"
msgstr ""
 
msgid "One potato"
msgid_plural "{{count}} potatoes"
msgstr[0] ""
msgstr[1] ""

API

You can also use parts of this as programmatic APIs, if you wish so:

const extract = require('react-globe-cli/extract')
extract(string) // -> ['Text', 'Text2', ['Singular', 'Plural']]
 
const convert = require('react-globe-cli/convert')
convert(extractedArray) // -> gettext file as a string, ready for writing

Debugging

This module uses debug.

DEBUG='react-globe-cli' react-globe-cli --files='./src/**/*.js' --output='templates.pot'

Licence

MIT

Dependencies (6)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i react-globe-cli

    Weekly Downloads

    0

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    9.31 kB

    Total Files

    6

    Last publish

    Collaborators

    • queicherius