Translate a JSON Object
↳ Links: NPM | GitHub
A Node.js module to translate a JSON object from a detectable language to any other language via
⍗ Install
npm i translate-json-object
Example
var TJO = require('translate-json-object')();
TJO.init({
googleApiKey: 'api_key',
yandexApiKey: 'api_key'
});
var example = {
"name": "Please enter your name",
"list": ["translate", "object", "made", "easy"],
"nested": {
"hello": "hello",
"world": "world"
}
};
TJO.translate(example, 'es')
.then(function(data) {
console.log(data);
}).catch(function(err) {
console.log('error ', err)
});
RESULT ↴
{ name: 'por favor, escriba su nombre',
list: [ 'traducir', 'objeto', 'hecho', 'fácil' ],
nested: { hello: 'Hola', world: 'mundo' }
}
◉ API
See API Doc
✼ Others
TODO 🔧
✔︎ Adding yandex service v2.1.0
✔︎ Unit test v2.1.4
✔︎ JS Linting v2.1.3
✔︎ semantic-release-cli v2.2.0
☐ Adding bing translate service
☐ Adding cli utility
Reach Out ☮