java - 某些语言环境在 TTS 中不可用——包括西类牙语

标签 java android text-to-speech

当我使用此行为日语设置语言环境时,效果很好。

tts.setLanguage(Locale.JAPANESE);

当我替换法语、德语、意大利语和中文时,它也有效。

当我替换 SPANISH、RUSSIAN 或 HINDI 时,Eclipse 告诉我“SPANISH 无法解析或不是一个字段”[填写其他语言]。

我听说 Android 确实提供对这些语言的支持,所以我怎么可能找不到它们?

最佳答案

根据documentation the Locale object没有为西类牙语定义的常量。您可以尝试使用这个(未测试):

Locale locale = new Locale("es", "ES");
tts.setLanguage(locale);

但请记住这条注释(也来自 Locale 文档):

It is also a mistake to assume that all devices have the same locales available. A device sold in the US will almost certainly support en_US and es_US, but not necessarily any locales with the same language but different countries (such as en_GB or es_ES), nor any locales for other languages (such as de_DE). The opposite may well be true for a device sold in Europe.

关于java - 某些语言环境在 TTS 中不可用——包括西类牙语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23333469/

相关文章:

iphone - 适用于 iPhone 的文本转语音库

java - java中if语句中的while循环

java - Ionic 构建 Android 失败解析错误

android - 将sqlite数据库保存在android内存中

java - Android - Opencv - 错误:(-215) u != 0 in function void cv::Mat::create

c# - Speechsynthesizer (System.Speech.Synthesis.SpeechSynthesizer) - 在运行时更改音量或速率

c# - 中文 TTS 失败,而英语有效

java - azure api 应用程序 (tomcat) 通过 kudu 编辑 server.xml

java - 当您想要删除重复代码时,如何解决项目的循环依赖?

android - 弃用 Android 的 Canvas.clipRect()