po-extract v2.1.9
po-extract
A CLI tool for creating react-intl-compatible dictionaries from gettext .po-files.
What for? Many translators and software translation companies prefer to work with standardized dictionaries in the .po format, while developers are more comfortable working with language strings in a JavaScript or TypeScript compatible format.
Pre requirements
node.js:>=8.*
Installation
Install it with yarn:
yarn add po-extract --devOr with npm:
npm install po-extract --save-devUsage
- Add
scriptstopackage.json:
"scripts": {
+ "po:build": "po-extract",
+ "po:watch": "po-extract --watch",Create
.po-files (example). By default, the library looks for the directorydictionariesin the root of the project, you can change it, see CLI Options.Create target directory. By default, the library uses the
src/dictionariesdirectory in the root of the project, you can change it, see CLI Options.Run script to generate react-intl-compatible dictionaries:
yarn run po:buildOr with npm:
npm po:buildSee full example.
CLI Options
| Option | Type | Default | Description |
|---|---|---|---|
--fixPo | boolean | false | Fix translations order in .po files |
--outDir | string | ./src/dictionaries | Save output to the directory |
--outExt | string | .js | Output files extensions |
--targetDir | string | ./dictionaries | Target directory with .po files |
--watch | boolean | false | Run the extractor in watch mode |
License
MIT
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
3 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago