Reputation: 91
I want to make an application that can support different languages.
There is no problem with the "default" languages:
tts.setLanguage(Locale.ENGLISH);
And also some other:
Locale l = new Locale("ru","RU");
tts.setLanguage(l);
But a lot of others don't work, eg.:
Locale l = new Locale("hu","HU");
tts.setLanguage(l);
I have also tried "hu"
, "hu-HU"
, "hu-rHU"
, "HU"
... but nothing...
Also, it doesn't work with Turkish, Greek, Dutch, Czech...
Upvotes: 9
Views: 7287
Reputation: 1145
You must use ISO 639 alpha-2
or alpha-3
code for first parameter. It is "rus"
for Russian language. And ISO 3166 alpha-2
for second parameter. It is correct ("RU"
).
Here is list of ISO country codes:
Upvotes: 0
Reputation: 11
You have to change your phone's system language to Greek, Turkish, Dutch or whatever language you want, in order the Locale, take your Default Locale Language. I wrote println in order to check if the program takes your system language right
println(Locale.getDefault().country)
tts!!.setLanguage(Locale.getDefault())
Upvotes: 0
Reputation: 497
When you type Locale. the dropdown list opens, and available languages are listed as below:
There is no Hungarian (Magyarul), Turkish (Türkçe) available at this time.
Upvotes: 1
Reputation: 50036
Not all are supported, use: Locale.getAvailableLocales() to get available possible locales and test them against isLanguageAvailable, or since api21 you can use getAvailableLanguages() to directly get available languages for current TTS engine. You can install alternative TTS engine, ie. SVOX is quite good.
Upvotes: 6