gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 21:09:45 25 4
gpt4 key购买 nike

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

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com