Best way of using google translation by Python [closed]
I made my own google translate function for python ;)try it https://github.com/mouuff/Google-Translate-API
Google does in fact have an official translation API with a REST interface. You can check it out here. Note that it is a paid API with no free quota.
Try using the googletrans
module. For example:
from googletrans import Translatortranslator = Translator() # initalize the Translator objecttranslations = translator.translate(['see if this helps', 'tarun'], dest='hi') # translate two phrases to Hindifor translation in translations: # print every translation print(translation.text)# Output:# देखें कि इस मदद करता है# तरुण
The dicts of the supported languages (106) and their ISO639-1 codes:
import googletransprint(googletrans.LANGCODES) # {language name: iso639-1 language code}# orprint(googletrans.LANGUAGES) # {iso639-1 language code: language name}
See the docs for more information.