Python googletrans 模块不翻译

Python googletrans module not translating

我正在使用 googletrans 模块尝试按照以下内容在不同语言之间进行翻译。

import time
from googletrans import Translator
translator = Translator()

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

然而,这似乎根本没有尝试任何翻译。它只是 returns 这个:

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

...此模块当前是否正常工作?我做错了什么吗?安装的版本如下:

pip install googletrans==3.1.0a0

脚本正在翻译,但您提供的文本是一个专有名称,即使翻译后看起来也几乎一样。 我已经用下面的代码检查过了:

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)

输出如下:

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...")

希望对您有所帮助!

我做到了

from googletrans import Translator
translator = Translator()

translate = translator.translate('روسيا: نرفض الاتهامات الأمريكية "الحرة" بشأن أوكرانيا',  dest='en')

translate1 = translator.translate('مصادر إيرانية: تم التطرق إلى العديد من النقاط الخلافية خلال مؤتمر فيينا',dest='en')

print(translate.text)

print(translate1.text)

输出:

Russia: We reject "free" US accusations on Ukraine

Iranian sources: Many controversial points were raised during the Vienna 
Conference