Python googletrans library not translating correctly

旧街凉风 提交于 2021-01-27 16:26:39

问题


I'm using the google trans library to translate some comments from different languages to English. But when testing this library no matter what I try to translate it will say that the language 'src' is English. Even setting the 'src' to a specific language doesn't fix this problem.

Examples of this can be seen below:

Sample Code 1:

from googletrans import Translator
translator = Translator()
print(translator.translate('veritas lux mea'))

Output:

Translated(src=en, dest=en, text=veritas lux mea, pronunciation=veritas lux mea, extra_data="{'translat...")

Sample Code 2:

from googletrans import Translator
translator = Translator()
print(translator.translate('안녕하세요.'))

Output:

Translated(src=en, dest=en, text=안녕하세요., pronunciation=안녕하세요., extra_data="{'translat...")

Sample Code 3:

from googletrans import Translator
translator = Translator()
print(translator.translate('hola',src="es"))

Output:

Translated(src=en, dest=en, text=hola, pronunciation=hola, extra_data="{'translat...")

Thanks in advance for any help :)

来源:https://stackoverflow.com/questions/64867159/python-googletrans-library-not-translating-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!