translate icon indicating copy to clipboard operation
translate copied to clipboard

Result mismatch Google Translate

Open joeperpetua opened this issue 2 years ago • 5 comments

Hi guys, hope you are doing well. I know that you are pretty busy working on v3 and may are already aware of this already, but just in case I open this issue.

When using the GoogleTranslate service, the translation is different from what we get in the website/app:

  • Source: fr (auto)
  • Destination: en
  • Text: Sincèrement navré de ne pas avoir répondu à vos messages plus rapidement, lorsque le dossier est transmis aux développeurs, nous n'avons temporairement plus de visibilité dessus.

[1] Google translate result: Sincerely sorry for not having replied to your messages more quickly, when the file is transmitted to the developers, we temporarily no longer have visibility on it.

[2] translatepy result: Honestly sorry not to have answered your messages faster, when the file is transmitted to the developers, we do not temporarily have more visibility on it.

Any ideas of what/why could be this caused? I actually tried changing the session header as per #79 but it did not have any effect on the translation result.

[1] image

[2]

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import translatepy
>>> translatepy.Translator().translate("Sincèrement navré de ne pas avoir répondu à vos messages plus rapidement, lorsque le dossier est transmis aux développeurs, nous n'avons temporairement plus de visibilité dessus.", "en")
TranslationResult(service=Google, source=Sincèrement navré de ne pas avoir répondu à vos messages plus rapidement, lorsque le dossier est transmis aux développeurs, nous n'avons temporairement plus de visibilité dessus., source_language=fra, destination_language=eng, result=Honestly sorry not to have answered your messages faster, when the file is transmitted to the developers, we do not temporarily have more visibility on it.)
>>>

joeperpetua avatar Mar 27 '23 15:03 joeperpetua

Related issue: https://github.com/Animenosekai/translate/issues/22#issuecomment-913048735 Try to use GoogleTranslateV2 class as workaround: https://github.com/Animenosekai/translate/issues/22#issuecomment-922500361

ZhymabekRoman avatar Mar 27 '23 16:03 ZhymabekRoman

Thanks, that works well! So I understand that the GoogleTranslate service defaults to GoogleTranslateV1, right? I assumed it used the V2 by default 😅

joeperpetua avatar Mar 27 '23 17:03 joeperpetua

Thanks, that works well! So I understand that the GoogleTranslate service defaults to GoogleTranslateV1, right? I assumed it used the V2 by default 😅

Yup for now GoogleTranslateV1 is tried first

https://github.com/Animenosekai/translate/blob/1033e1f3eddb9f2d66cb4d7ffaeb6723864e10cc/translatepy/translators/google.py#L78-L86

The reason is that V1 should be the one used on the website, but we can't generate the right tokens for now : https://github.com/Animenosekai/translate/issues/22#issuecomment-913921088

Animenosekai avatar Mar 28 '23 08:03 Animenosekai

@Animenosekai so v2 better than v1?

ghost avatar Jul 20 '23 11:07 ghost

@Animenosekai so v2 better than v1?

Well without reverse engineering the token generation, yes (maybe?)

Animenosekai avatar Jul 20 '23 12:07 Animenosekai