translate-puppeteer
v1.0.5
Published
translateToChinese
Downloads
8
Readme
translateToChinese
Translate a web page into Chinese using Puppeteer
Copy code
npm install translate-puppeteer
const translateToChinese = require('translate-puppeteer');
async function main() {
const userMessage = "Translate this to Chinese.";
try {
const chineseTranslation = await translateToChinese(userMessage);
console.log(`User: ${userMessage}`);
console.log(`Translated to Chinese: ${chineseTranslation}`);
} catch (error) {
console.error('An error occurred:', error);
}
}
main();