@cosmic-plus/i18n-extractor

1.2.0 • Public • Published

@cosmic-plus/i18n-extractor

Licence Dependencies Vulnerabilities Size Downloads

Command-line interface that extract internationalized strings for translators. It is exclusively developed for @cosmic-plus/i18n.

Install

Locally

  • NPM: npm install --save-dev @cosmic-plus/i18n-extractor
  • Yarn: yarn add --dev @cosmic-plus/i18n-extractor

Globally

  • NPM: npm install -g @cosmic-plus/i18n-extractor
  • Yarn: yarn global add @cosmic-plus/i18n-extractor

Usage

i18n-extractor [LANGUAGES|'all'] SOURCE_DIR...

If LANGUAGES is provided, update/create translation files for LANGUAGES with internationalized strings extracted from SOURCE_DIR. If LANGUAGES is not provided, update any already existing translation files. LANGUAGES must be a comma-separated list of languages, such as cn,es,pt.

When no SOURCE_DIR is provided, uses ${project_root}/src. Translation files are created at ${project_root}/locales/${language}.json.

Add a new translation

i18n-extractor ${language} src

Update existing translations

i18n-extractor all src

Add as a script into your package.json

Add the following into your package scripts:

"scripts": {
  "i18n": "i18n-extractor all ./src"
}

You can now update translations files using:

npm run i18n

Package Sidebar

Install

npm i @cosmic-plus/i18n-extractor

Weekly Downloads

2

Version

1.2.0

License

MIT

Unpacked Size

8.07 kB

Total Files

5

Last publish

Collaborators

  • misterticot