language translation - Text is not translated when I use translate Lib in Python - Stack Overflow

When I use translate Lib in Python to translate text it returns the same text without translationfrom

When I use translate Lib in Python to translate text it returns the same text without translation

from translate import Translator
translator= Translator(to_lang="en")
res = translator.translate("C'est la vie")
print(res)

the returned value is the same

C'est la vie

When I use translate Lib in Python to translate text it returns the same text without translation

from translate import Translator
translator= Translator(to_lang="en")
res = translator.translate("C'est la vie")
print(res)

the returned value is the same

C'est la vie

Share Improve this question edited Mar 11 at 10:58 Daraan 4,2427 gold badges22 silver badges47 bronze badges asked Mar 11 at 10:56 AhmedAhmed 114 bronze badges 1
  • 1 That might be something to ask the author of that library… – deceze Commented Mar 11 at 11:08
Add a comment  | 

1 Answer 1

Reset to default 1

You missed a key argument in Translator(), and that is from_lang =. Here is your corrected code with the translation.

from translate import Translator
translator = Translator(from_lang="fr", to_lang="en")
res = translator.translate("C'est la vie")
print(res)

That's life

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744799954a4594433.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信