Python‎ > ‎

Python Google Translator

Installation


4 April 2021:
    Note: Due to recent changes to Google's API you need to install this version of Python Googletrans
    
    pip install googletrans==3.1.0a0

Important thing to note: You have to specify a service url, otherwise the same error still occurs. So this should work:

from googletrans import Translator
translator = Translator(service_urls=['translate.googleapis.com'])
translator.translate("Der Himmel ist blau und ich mag Bananen", dest='en')

Simple Example code:

#!/usr/bin/env python

from googletrans import Translator

translator = Translator()
translated = translator.translate('Бороди́нское сраже́ние')

print(translated.text)

For more information:






Comments