oltodosel / interSubs

Interactive subtitles for mpv. Instantly translate selected word/sentence.
MIT License
225 stars 20 forks source link

google translate error #31

Closed sergio-kzn closed 3 years ago

sergio-kzn commented 3 years ago

Hi, i'm having trouble translating with google. I found out that py-googletrans stopped working - some problems with the connection.

I used https://github.com/lushan88a/google_trans_new

and everything works great.

if anyone is interested:

interSubs.py

from google_trans_new import google_translator

def google_new(text):
    l2 = config.lang_to.upper()
    if len(text) > 5000:
        return 'Text too long (limited to 5000 characters).'

    translator = google_translator()
    translate_text = translator.translate(text, lang_tgt=l2)

    return translate_text

and interSubs_config.py

translation_function_name_full_sentence = 'google_new'
oltodosel commented 3 years ago

Fixed with https://github.com/Saravananslb/py-googletranslation