Skip to content

Commit

Permalink
Use BCP 47 locale codes for Voice.getLocale() to support the correct …
Browse files Browse the repository at this point in the history
…localization on Lollipop and later.
  • Loading branch information
rhdunn committed Oct 12, 2015
1 parent d19f4fb commit bb3b7e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -123,8 +123,8 @@ public void testVoices()

assertThat(data, is(notNullValue()));
assertThat(voice.getName(), is(data.name));
assertThat(voice.getLocale().getLanguage(), is(data.javaLanguage));
assertThat(voice.getLocale().getCountry(), is(data.javaCountry));
assertThat(voice.getLocale().getLanguage(), is(data.ianaLanguage));
assertThat(voice.getLocale().getCountry(), is(data.ianaCountry));
assertThat(voice.getLocale().getVariant(), is(data.variant));
assertThat(voice.getFeatures(), is(notNullValue()));
assertThat(voice.getFeatures().size(), is(0));
Expand All @@ -139,8 +139,8 @@ public void testVoices()
android.speech.tts.Voice voice2 = getEngine().getVoice();
assertThat(voice2, is(notNullValue()));
assertThat(voice2.getName(), is(data.name));
assertThat(voice2.getLocale().getLanguage(), is(data.javaLanguage));
assertThat(voice2.getLocale().getCountry(), is(data.javaCountry));
assertThat(voice2.getLocale().getLanguage(), is(data.ianaLanguage));
assertThat(voice2.getLocale().getCountry(), is(data.ianaCountry));
assertThat(voice2.getLocale().getVariant(), is(data.variant));
assertThat(voice2.getFeatures(), is(notNullValue()));
assertThat(voice2.getFeatures().size(), is(0));
Expand Down
2 changes: 1 addition & 1 deletion android/src/com/reecedunn/espeak/TtsService.java
Expand Up @@ -220,7 +220,7 @@ public List<android.speech.tts.Voice> onGetVoices() {
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;
}
Expand Down

0 comments on commit bb3b7e9

Please sign in to comment.