Improve your programming skills

Python googletrans

How to user googletrans

# pip install googletrans
# If we do not specify the source and the destination languages,
# googletrans tries to detect the language and translates it into English.

import googletrans
from googletrans import Translator

# without language source and destination choose
#translator = Translator()
#translated = translator.translate('jestem najlepszy')

# with language source and destination choose. From polish to english
translator = Translator()
translated = translator.translate('to jest najlepsze szkolenie', src='pl', dest='en')

# reverse with translated sentence. Now from english to polish
translated = translator.translate(translated.text, src='en', dest='pl')

Leave a comment

Your email address will not be published. Required fields are marked *