react-intl-po
Extract POT from react-intl and convert back to json.
messages.json → POT → PO → translation.json
Installation
$ npm install react-intl-po --save
Requirements and Workflow
- react-intl
- babel-plugin-react-intl
Usage
There are two sub-commands of react-intl-po
or rip
:
- json2pot: Convert
babel-plugin-react-intl
's output json file to one .pot file. - po2json: Convert one translated .po file back to json format.
json2pot
$ rip json2pot '_translations/src/**/*.json' \
-o ./mcs-public.pot
Arguments | Description |
---|
srcPatterns | babel-plugin-react-intl 's output json file |
output (-o) | .pot file to be translated |
po2json
$ rip po2json './node_modules/mcs-translation/po/mcs-public*.po' \
-m './_translations/src/**/*.json' \
-o './translations.json'
Arguments | Description |
---|
srcPatterns | translated .po files |
messagesPattern (-m) | babel-plugin-react-intl 's output json file |
output (-o) | ouput one json formated file to be used in SSR |
API
Property
Test
$ npm run test:watch
CONTRIBUTING
- ⇄ Pull requests and ★ Stars are always welcome.
- For bugs and feature requests, please create an issue.
- Pull requests must be accompanied by passing automated tests (
$ npm test
).
MIT: http://michaelhsu.mit-license.org