google-translate-api icon indicating copy to clipboard operation
google-translate-api copied to clipboard

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

Open funnel20 opened this issue 1 year ago • 1 comments

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 ❌

funnel20 avatar Jun 13 '24 09:06 funnel20

Will investigate when I get the chance

AidanWelch avatar Jul 29 '24 02:07 AidanWelch