transl8
v0.2.1
Published
Translates locale files into multiple languages using Google's Cloud Translation API
Downloads
4
Readme
transl8-js
Instantly translates your locale files into multiple languages using Google's Cloud Translation API.
Installation
npm install -g transl8
From the Command Line
Usage: $ transl8 [options]
| Options | Description |
| ----------- | ---------------------------------------------------------------------------------------------------------------------- |
| --key
| Google Cloud API Key. Register one here (Required) |
| --infile
| Your source locale file. .js
and .json
files are valid (Required) |
| --outdir
| Output directory for translated files (Default: ./output
) |
| --locales
| Target translation tags (Required) |
| --verbose
| 1
or true
for warnings, 2
for info, 3
for errors (Default false
) |
Examples
transl8 --key $GOOGLE_API_KEY --locales fr es --infile ./en.json
transl8 --key $GOOGLE_API_KEY --locales lv --outdir translations --infile ./en.js
Via Node Module
const transl8 = require('transl8')
transl8({
key: 'XXXXX',
source: {
hello: 'Hello World',
},
locales: ['fr', 'es'],
verbose: false,
})
.then(result => { ... })
Result
{
"fr": {
"hello": "Bonjour le monde"
},
"es": {
"hello": "Hola Mundo"
}
}