npm.io
3.0.1 • Published 6 years agoCLI

translocalizer

Licence
MIT
Version
3.0.1
Deps
3
Size
179 kB
Vulns
25
Weekly
0

Translocalizer

Travis Version Issues License Dependencies

Translocalizer is a tool for localizing your application in seconds.

Available Languages

Translocalizer uses Yandex Translate under the hood, so check this page for the list of available languages.

Installation

Yarn:

$ yarn add -D translocalizer

NPM:

$ npm install -D translocalizer

Usage

To use Translocalizer, you will need a Yandex Translate API key, which you can obtain here. Create a new key for every project since using a certain key too many times in succession can lead to rate limiting.

Using the CLI
// translocalizer.json

{
  "basePath": "i18n",
  "srcFile": "en.json",
  "filenameTemplate": "*.json",
  "languages": ["fr", "it"],
  "apiKey": "trnsl.1.1..."
}
$ translocalizer [options]

To see all available options, run this command:

$ translocalizer --help
Using the API
import { Translocalizer } from "translocalizer";

const config = {
  basePath: "i18n",
  srcFile: "en.json",
  filenameTemplate: "*.json",
  languages: ["fr", "it"],
  apiKey: "trnsl.1.1..."
};

Translocalizer.localize(config);