extract-getext
Extract gettext strings from __('literal')
and __n('single', 'plural', n )
functions in any source.
This module currently only looks for the __
and __n
function signatures.
The format produced by this package is similar to the output of xgettext
, containing all strings in one flat array.
When outputting a .json file, the format is usable by i18next-conv.
Install
npm install extract-gettext
Usage
CLI
extract-gettext -o <output file> -x <exclude pattern> **/*.js
API
( as taken from the "test" )
let scan = ; { ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; } let strings = ; console;
background
The tool xgettext
has good support for javascript, and extracts strings faster then this tool, but is hardcoced for the _('literal')
notation.
Some other good tools exist, such as:
roadmap and future development
Please drop me a personal note on matthijsatischendotnl if you want to use this and I need to fix things.