1.5.1 • Published 7 months ago

@somsoft/i18n-translate-json v1.5.1

Weekly downloads
-
License
GPL
Repository
github
Last release
7 months ago

i18n-translate-json

Automatically translates node-i18n JSON files into different languages via Google Translate API.

Installation

Global:

npm install -g @somsoft/i18n-translate-json

Project (Development only):

npm install --save-dev @somsoft/i18n-translate-json

Usage

You need a Google Translate API Key.

i18n-translate-json apiKey dir sourceLang (targetLang1,targetLang2,..) [--options]

e.g.

i18n-translate-json iuOHAEbo9H788d34h93h4diouehIUHI locale/ en es,fr --missingOnly --cleanUp --spaces 2

This would translate all strings in locale/en.json (relative to current folder in the shell) from English to Spanish and French, based on the Google Translate API language codes.

The target languages list is optional. When not present, it will be translated to all languages supported by Google Translate.

Options

OptionDescription
includeHtmlInclude HTML entries in the translation
missingOnlyIf set, do not overwrite existing translation
cleanUpIf set, removes unused translations at target files.
spaces numberNumber of spaces in output-json. If option is omitted, tabs are used.
ignoreRegExp stringA Regular expression used to define texts parts not to be translated.
For angular interpolation variables, use \{\{\s*(.*?)\s*\}\}. Default: Translate all.
helpShow help

Publish npm

Run npm run publish:<major|minor|patch> to publish a new major, minor or patch version to npm.

Credits

Based on i18n-translate by Thomas Brüggemann. Based on i18n-translate-json by Meedan.

1.5.1

7 months ago

1.5.0

10 months ago

1.3.6

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago