Back-end Developer at Goomer.
ribeirogab / free-translate Goto Github PK
View Code? Open in Web Editor NEW🈂️ ⠀A free and unlimited translator for Node.js.
Home Page: https://www.npmjs.com/package/free-translate
🈂️ ⠀A free and unlimited translator for Node.js.
Home Page: https://www.npmjs.com/package/free-translate
Back-end Developer at Goomer.
Increase translation timeout to 30 seconds. is currently in 15 seconds.
while (!translatedText) {
await page.goto(
`https://translate.google.com/?sl=${from}&text=${text}&tl=${to}`,
);
await page.waitForTimeout(waitingTime);
translatedText = await page.evaluate(
() => document?.querySelector('span[jsname=W297wb]')?.innerHTML,
);
waitingTime += 1000;
if (waitingTime >= 15000) throw new Error('Timeout!');
}
Feature to translate texts in the available languages.
example code:
const { translate } = require('free-translate');
// import { translate } from 'free-translate';
(async () => {
const translatedText = await translate('hello world', { from: 'en', to: 'pt' });
console.log(translatedText); // Olá Mundo
})();
why its not working on server-side, its showing timeOut
Hi there!
I was trying something really simple like this snippet:
const { translate } = require('free-translate');
(async () => {
const translatedText = await translate('hello world', { from: 'en', to: 'pt' });
console.log(translatedText); // Olá Mundo
})();
But unfortunately, when I execute it with the node .\index.js command, I get the following error after 1 minute:
throw new Error(error_1);
^
Error: Error: .wait() for span[jsname=jqKxS] timed out after 60000msec
Am I doing something wrong?
console.log('en', language, namespace, prepareTranslationKey); const translatedText = await translate(prepareTranslationKey, { from: 'en', to: language });
pl 404 Page ${{path}} was not found.
(node:5377) UnhandledPromiseRejectionWarning: Error: Error: .wait() for span[jsname=jqKxS] timed out after 60000msec
Google Translate supports the "auto" option as a parameter.
Implement this functionality in the library, taking into account the following use case:
const { translate } = require('free-translate');
// import { translate } from 'free-translate'; Node.js >= v13
(async () => {
const translatedText = await translate('eu falo inglês', 'en');
console.log(translatedText); // I speak English
})();
Google Translate currently supports only 500 characters for translation.
Task:
can you add more params to output maybe something like this
resolve({
code: 200,
result: res.text,
autoCorrected: res.from.text.autoCorrected,
pronunciation: res.pronunciation,
from: res.from.language.iso,
to: To
})
Write a README with the necessary documentation for using the library.
The problem is nightmare not your code.
segment-boneyard/nightmare#1636
Do you have any ideas to switch to another light weight automation??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.