💥 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
andtPlural
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. thestage-0
babel plugin) you will have to pre-compile that.
Example
Input (JS)
// ...// ...<h1></h1>// ...
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 = // -> ['Text', 'Text2', ['Singular', 'Plural']] const convert = // -> 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