Text To Speech In Chinese Not Working

I have been working my way through the Python handbook. I recently created a text to speech program in Python. All the code works well when using Google gTTS to read English sentences. But, when I try to change the language to Chinese (zh-CN) my code does not work at all. What am I doing wrong? My code is below. I submitted the following Pinyin Chinese text into my code below:
“Wǒ yào”

Here is my code:

#import Google's text to speech into your program 
from gtts import gTTS 
#grab data from user and store it in a variable 
mt = input("Please enter the information you would like me to read:  \t")
#Choose your recording language and store it in a variable 
language = 'zh-CN' 
#Transfer the recording into text to speech and save it in a variable 
voice = gTTS(text=mt, lang=language, slow=False)
#save the recording which was in above variable and put it in a mp3 file

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.