Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text to Speech Locale Hindi Indian

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

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" };

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.

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.

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

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.

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

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?

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

like image 778
brandall Avatar asked Feb 06 '14 09:02

brandall


1 Answers

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.


*This needs a proper citation from sources: I just made my conclusion based on existing TTS engine implementations.
like image 160
ozbek Avatar answered Sep 28 '22 23:09

ozbek