Reputation: 647
I am trying to translate some text using deep_translator
, but I am not getting the output that I expected.
Here's my code:
from deep_translator import GoogleTranslator
translator = GoogleTranslator(target="irish")
text_to_translate = "Hello, how are you?"
translated_text = translator.translate(text_to_translate)
print(translated_text)
Here when I run the code, the output is the same and the text does not seem to get translated.
Is there any way to fix this problem?
It would be great if anyone could help me out.
Upvotes: 1
Views: 3642
Reputation: 647
I posted this issue to the developer of deep_translator
, and he fixed this problem.
All you need to do is update deep_translator
to it's latest version.
In your command prompt, type:
pip uninstall deep_translator
pip install deep_translator
Upvotes: 2
Reputation:
Here in the above code everything is fine . But you forgot to add 'source'.
Modified code:
from deep_translator import GoogleTranslator
translator = GoogleTranslator(source='en',target='german')
text_to_translate = "Hello, how are you?"
translated_text = translator.translate(text_to_translate)
print(translated_text)
Upvotes: 0