Use BCP 47 locale codes for Voice.getLocale() to support the correct localization on Lollipop and later.

This commit is contained in:
Reece H. Dunn
2015-10-12 21:29:55 +01:00
parent d19f4fbb5c
commit bb3b7e9a00
2 changed files with 5 additions and 5 deletions
@@ -220,7 +220,7 @@ public class TtsService extends TextToSpeechService {
int latency = android.speech.tts.Voice.LATENCY_VERY_LOW;
Locale locale = new Locale(voice.locale.getISO3Language(), voice.locale.getISO3Country(), voice.locale.getVariant());
Set<String> features = onGetFeaturesForLanguage(locale.getLanguage(), locale.getCountry(), locale.getVariant());
voices.add(new android.speech.tts.Voice(voice.name, locale, quality, latency, false, features));
voices.add(new android.speech.tts.Voice(voice.name, voice.locale, quality, latency, false, features));
}
return voices;
}