pythongoogle-translation-apigoogletrans

Python googletrans module not translating


I am using the googletrans module to try and translate between languages as per the below.

import time
from googletrans import Translator
translator = Translator()

translate_channel = translator.translate('Canal La Tele Perú', src='es', dest='en')

However, this doesn't seem to be attempting any translation at all. It just returns this:

Translated(src=en, dest=en, text=Canal La Tele Perú, pronunciation=Canal La Tele Perú, extra_data="{'translat...")

...is this module currently working? Have I done something wrong? Version installed is as per the below:

pip install googletrans==3.1.0a0

Solution

  • The script is translating, but the text you've provided is a proper name and even if its translated it looks almost the same. I've checked it with the code below:

    from googletrans import Translator
    translator = Translator()
    
    translate_channel = translator.translate('Canal La Tele Perú', src='es', dest='en')
    translate_channel2 = translator.translate('La defensa y las acciones ofensivas de Alex Dujshebaev dan a Españasu cuarto bronce en unos Juegos tras los de Atlanta 1996, Sydney 2000 y Pekín 2008.', src='es', dest='en')
    print(translate_channel)
    print(translate_channel2)
    

    And the output was like:

    Translated(src=es, dest=en, text=Channel La Tele Peru, pronunciation=Channel La Tele Peru, extra_data="{'translat...")
    Translated(src=es, dest=en, text=The defense and offensive actions of Alex Dujshebaev give Spain its fourth bronze in a Games after those of Atlanta 1996, Sydney 2000 and Beijing 2008., pronunciation=The defense and offensive actions of Alex Dujshebaev give Spain its fourth bronze in a Games after those of Atlanta 1996, Sydney 2000 and Beijing 2008., extra_data="{'translat...")
    

    Hope it helped!