I am trying to translate large number of text files from English to other several languages. And we use Python in our project, we try to use Google translation service to transl
Use this This code is using google trans module which is free to use.
NOTE - IMPORTING METHOD OF googletrans IS DIFFERENT FROM OTHER MODULES SO KINDLY WATCH THIS TUTORIAL FIRST.
From this code you can convert any language to any language and also get pronunciation of it.
from googletrans import Translator, LANGUAGES
from googletrans.models import Translated
lang = list(LANGUAGES.values())
print("Welcome to Py_Guy Translate")
input_text = input("Please Enter Your Text in english:\n")
out_lang = input("Please enter output language name (ex.-hindi,gujarati,japanese:\n
").lower()
if out_lang not in lang:
print("Sorry This Language is not available to translate")
else:
translator = Translator()
translated = translator.translate(text=input_text, src="english",dest=out_lang)
translated = str(translated).split(", ")
converted = translated[2]
pro = translated[3]
print(converted)
print(pro)
Watch the video tutorial here to get better understanding about the code