const { promisify } = require("util");
const translator = require("google-translator");
const translate = (...args) => new Promise(resolve => translator(...args, resolve));
const inputText = "whisper";
const inputLang = 'en'
// translate the inputText to each language
const languages = translator.languages; // get all languages
for (const lang in languages) {
console.log(lang + " " + (await translate(inputLang, lang, inputText)).text);
}
Created from: https://npm.runkit.com/google-translator