1.1.2 • Published 1 year ago

po-extract v1.1.2

Weekly downloads
18
License
MIT
Repository
github
Last release
1 year ago

po-extract

NPM version CI workflow

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 --dev

Or with npm:

npm install po-extract --save-dev

Usage

  1. Add scripts to package.json:
"scripts": {
  + "po:build": "po-extract",
  + "po:watch": "po-extract --watch",
  1. Create .po-files (example). By default, the library looks for the directory dictionaries in the root of the project, you can change it, see CLI Options.

  2. Create target directory. By default, the library uses the src/dictionaries directory in the root of the project, you can change it, see CLI Options.

  3. Run script to generate react-intl-compatible dictionaries:

yarn run po:build

Or with npm:

npm po:build

See full example.

CLI Options

OptionTypeDefaultDescription
--fixPobooleanfalseFix translations order in .po files
--outDirstring./src/dictionariesSave output to the directory
--outExtstring.jsOutput files extensions
--targetDirstring./dictionariesTarget directory with .po files
--watchbooleanfalseRun the extractor in watch mode

License

MIT

1.1.2

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago