HI ,
Can any one help me in writing script to translate data in excel file to 7 different languages.
HI ,
Can any one help me in writing script to translate data in excel file to 7 different languages.
Interesting question.
May be the below scripts helps, it uses the Googletrans API which was made free as of now. It supports 108 language as of now.
import pandas as pd
from googletrans import Translator
df = pd.read_excel(‘spreadsheet.xlsx’)
translator = Translator()
df[‘French’] = df[‘text’].apply(translator.translate,src=‘en’,dest=‘fr’).apply(getattr, args=(‘text’,))
df.to_excel(‘name_of_your_output_file.xlsx’)
Kindly refer the below package for this, make sure this is installed into your environment.
Refer the below doc for more functionality and languages.
https://py-googletrans.readthedocs.io/en/latest/
Some, Indian languages are also there like Hindi, Punjabi and Odia etc.
Incase you are also working with Text to speech use gTTS,
All the very best!