文本到语音区域设置印地文印语音、文本、区域、印地

2023-09-05 02:36:02 作者:倾世璃歌

我创建了一个文本到语音引擎为Android,支持多国语言,其中之一是印地文。

I've created a Text to Speech Engine for Android that supports many languages, one of which is Hindi.

在Android的文本到语音设置,当用户选择一个默认的语言环境,Android的做了一些检查,包括发送意图 ACTION_GET_SAMPLE_TEXT

In the Android Text to Speech Settings, when the user selects a default locale, Android does a number of checks including sending the intent ACTION_GET_SAMPLE_TEXT

下面是我支持的语言环境的列表:

Here is my list of supported locales:

private static final String[] SUPPORTED_LANGUAGES = { "eng-GBR", "eng-USA", "fra-FRA", "spa-ESP", "deu-DEU", "ita-ITA",
        "kor-KOR", "nld-NLD", "dan-DNK", "fin-FIN", "jpn-JPN", "nor-NOR", "pol-POL", "por-PRT", "por-BRA", "rus-RUS",
        "swe-SWE", "zho-CHN", "zho-HKG", "zho-TWN", "ara-SAU", "hi-IN", "ces-CZE", "ell-GRC", "hun-HUN", "ron-ROU",
        "slk-SVK", "tha-THA", "tur-TUR", "cym-GBR", "isl-ISL", "in-IDN" };

有关各个地区不是HI-IN等,机器人发送这个意图,我与示例文本响应和听一个例子按钮变为可用。

For every Locale other than "hi-IN", Android sends this intent and I respond with the example text and the "Listen to an example" button becomes available.

我成功返回 LANG_COUNTRY_AVAILABLE从呼叫以 onIsLanguageAvailable ,但按钮仍显示为灰色,并指出不支持的语言。

I'm successfully returning LANG_COUNTRY_AVAILABLE from the call to onIsLanguageAvailable, but the buttons remain greyed out and it states that the language is not supported.

我已经试过了现场的这么多不同的ISO组合:

I've tried so many different ISO combinations of the locale:

欣-IN,HI-IND,IND-HI等等等等等等,但是Android不发送的意图,尽管它是在区域设置列表中正确标注为印地文(印度),或只印地文。

hin-IN, hi-IND, ind-HI etc etc etc, but Android doesn't send the Intent, despite it being labelled correctly in the Locale list as Hindi(Indian) or just Hindi.

有在logcat中提出一个变种比赛失败没有错误。

There are no errors in the logcat to suggest a failed variant match.

有小点,我公布我的code,由于Android根本不会发送意向在这个地方,所以它不会让我达到code ....

There's little point me posting my code, as Android simply doesn't send the Intent for this Locale, so it doesn't get to reach my code....

任何想法如何正确处理这种语言环境变量?

Any ideas how to correctly handle this locale variant?

编辑:我刚刚意识到它也发生印尼(同IDN)

I've just realised it's also happening for Indonesian (in-IDN)

推荐答案

TTS使用3个字母的codeS * 的的语言和的区域。因此,基于这种语言/国家code为:

TTS uses 3-letter codes* for language and locale. So, based on that language/country code for:

Hindi         hin-IND
Indonesian    ind-IDN

希望这有助于。

Hope this helps.

* 这需要一个适当的引用来源。我只是做我的结论基于现有的TTS引擎实现的