Open neran27 opened 6 years ago
var toLang = 'hi'; translate(engText, {from:'en',to: toLang}).then(resp => { var outStr = resp.text; console.log("output - 1: " +outStr); }).catch(err => { console.error(err); });
This code should work fine, however, this repo has been broken for a while now, so try using https://github.com/vitalets/google-translate-api instead.
var toLang = 'hi'; translate(engText, {from:'en',to: toLang}).then(resp => { var outStr = resp.text;
console.log("output - 1: " +outStr);
}).catch(err => { console.error(err); });