soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.83k stars 387 forks source link

-no-autocorrect doesn't work with Google translate #499

Closed superarts closed 8 months ago

superarts commented 9 months ago

As shown in the following example, I tried to translate with -no-autocorrect but "Did you mean: There's demons closing' in on every side" still shows up. Am I using it in the wrong way please? I checked closed issues but couldn't find any clue.


# trans -no-autocorrect en:es "There's demons closin' in on every side"
Did you mean: There's demons closing' in on every side
There's demons closin' in on every side

Hay demonios acercándose por todos lados

Translations of There's demons closin' in on every side
[ English -> Español ]

There's demons closin' in on every side
    Hay demonios acercándose por todos lados, Hay demonios acechando por todos lados
###
scottmberry commented 9 months ago

I am seeing the same issue.

soimort commented 8 months ago

There are two types of prompts: (1) the "Did you mean" hint and (2) the "Showing translation for" hint. For type (1), it is merely a hint that doesn't auto-correct anything, so the original text is still translated as it is. For type (2), it does auto-correct your text, and you can add -no-autocorrectto prevent this. The -no-auto option will not have any effect on type (1).

For example, in case (1),

$ trans en:es "There's demons closin' in on every side" 
Did you mean: There's demons closing' in on every side
There's demons closin' in on every side

Hay demonios acercándose por todos lados

Adding -no-auto won't change anything because it is already translating the original text.

For case (2), assume "in" was misspelt as "inn":

$ trans en:es "There's demons closin' inn on every side" 
Showing translation for:  (use -no-auto to disable autocorrect)
There's demons closing' in on every side

Hay demonios acercándose por todos lados

Adding -no-auto will tell Google Translate not to auto-correct "inn" to "in", then you'll get something like "la posada" in the translation:

$ trans -no-auto en:es "There's demons closin' inn on every side" 
Showing translation for:  (use -no-auto to disable autocorrect)
There's demons closin' inn on every side

Hay demonios cerrando la posada por todos lados

If you wish to suppress the type (1) "Did you mean" prompt, the right option to use is -no-warn .