我正在使用http://mobile.tutsplus.com/tutorials/android/android-sdk-using-the-text-to-speech-engine/上的示例
我已将其更改为Local.US
以下内容:Local.JAPANESE
Local.JAPAN
public void onInit(int initStatus) {
//check for successful instantiation
if (initStatus == TextToSpeech.SUCCESS) {
if(myTTS.isLanguageAvailable(Locale.JAPANESE)==TextToSpeech.LANG_AVAILABLE)
myTTS.setLanguage(Locale.JAPANESE);
}
else if (initStatus == TextToSpeech.ERROR) {
Toast.makeText(this, "Sorry! Text To Speech failed...", Toast.LENGTH_LONG).show();
}
}
该应用程序运行良好,当设置为 Local.JAPANESE 时,可以正常地说英语单词。
如果我在栏中输入 こんにちは 并单击按钮,它会发出咔哒声。它没有显示 Toast 消息说它不支持该语言。
这是当我点击日文文本时从 logcat 输出的内容:
W/patts ( 1697): [verbalize_controller.cc:366] Failed to find verbatim rule for character
W/patts ( 1697): [verbalize_controller.cc:366] Failed to find verbatim rule for character �
W/patts ( 1697): [verbalize_controller.cc:366] Failed to find verbatim rule for character �
谢谢您的帮助!