Animenosekai / translate

A module grouping multiple translation APIs
GNU Affero General Public License v3.0
525 stars 60 forks source link

Proxy Support #64

Closed cefege closed 2 years ago

cefege commented 2 years ago

Please Add proxy support so we can decrease the chance of getting banned when translating from Google for example.

Animenosekai commented 2 years ago

We already have proxy support though 🤔

Animenosekai commented 2 years ago

Ohhhh I'm sorry I didn't document it, my bad.

To add proxies, you need to pass your own Request instance, with the proxies.

Example

from translatepy.utils.request import Request
from translatepy import Translator

t = Translator(request=Request(proxy_urls=["<your proxy>"]))
t.translate("Hello world", "Japanese")
cefege commented 2 years ago

Thanks, it's awesome proxies work.

Can you please explain what are the differences between GoogleTranslateV1 and GoogleTranslateV2?

Which one is the recommended method for large scale translation, more stable?

How does the program decide which to use if I select GoogleTranslate? For example if GoogleTranslateV1 fails, does it try with GoogleTranslateV2?

Best Regards,

Mike

On Mon, Jul 4, 2022 at 11:20 PM Anise @.***> wrote:

Closed #64 https://github.com/Animenosekai/translate/issues/64 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Animenosekai/translate/issues/64#event-6930006370, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAET455UQBOSDRWSGPMY3ILVSNBP7ANCNFSM52UDCRYA . You are receiving this because you authored the thread.Message ID: @.***>

ZhymabekRoman commented 2 years ago

Can you please explain what are the differences between GoogleTranslateV1 and GoogleTranslateV2?

Class GoogleTranslateV1 are using Google's new batchexecute (JSONRPC) API that are used in Google Translate web application. Class GoogleTranslateV2 uses official API methods that are used in Google Translate mobile application. In a nutshell, they use different endpoints.

Which one is the recommended method for large scale translation, more stable?

GoogleTranslateV2, as GoogleTranslateV1 does not give an accurate translation, see - https://github.com/Animenosekai/translate/issues/22

For example if GoogleTranslateV1 fails, does it try with GoogleTranslateV2?

Yes