Best way of using google translation by Python
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 Translator
translator = Translator() # initalize the Translator object
translations = translator.translate(['see if this helps', 'tarun'], dest='hi') # translate two phrases to Hindi
for translation in translations: # print every translation
print(translation.text)
# Output:
# देखें कि इस मदद करता है
# तरुण
The dicts of the supported languages (106) and their ISO639-1 codes:
import googletrans
print(googletrans.LANGCODES) # {language name: iso639-1 language code}
# or
print(googletrans.LANGUAGES) # {iso639-1 language code: language name}
See the docs for more information.
I made my own google translate function for python ;) try it https://github.com/mouuff/Google-Translate-API