AidanWelch / google-translate-api

An updated free and unlimited API for Google Translate :dollar: :no_entry_sign:
MIT License
136 stars 18 forks source link

`res.from.language.didYouMean` is always true #45

Open funnel20 opened 2 months ago

funnel20 commented 2 months ago

When I use the Google Translate website from English to Dutch, and enter the Dutch word "Kaartspel" in the English from box, it shows "Translate from: Dutch":

Screenshot 2024-06-13 at 11 18 32

See: https://translate.google.com/?sl=en&tl=nl&text=Kaartspel&op=translate

When I use this API:

const res = await translate('Kaartspel', { from: 'en', to: 'nl', autoCorrect: true, requestFunction: fetch});
console.log(res.from.language.didYouMean);
console.log(res.from.language.iso);

It prints:

true
nl

This is correct ✅

Repeat with a correct English "Card game", there is no warning in the portal:

Screenshot 2024-06-13 at 11 24 08

See: https://translate.google.com/?sl=en&tl=nl&text=Card%20game&op=translate

When I use this API:

const res = await translate('Card game', { from: 'en', to: 'nl', autoCorrect: true, requestFunction: fetch});
console.log(res.from.language.didYouMean);
console.log(res.from.language.iso);

It prints:

true
en

Although res.from.language.iso changed correctly to "en", res.from.language.didYouMean is still true. This is incorrect ❌

AidanWelch commented 1 month ago

Will investigate when I get the chance