fix build

This commit is contained in:
sonora 2016-12-20 14:58:21 +01:00
parent 6243b075ee
commit ec6a5c38dc

View file

@ -166,13 +166,13 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
ttsRequests = 0;
final float speechRate = cSpeechRate;
Locale newLocale = new Locale(language);
private Locale newLocale = new Locale(language);
// #3344: Try Locale builder instead of constructor (only available from API 21)
if (android.os.Build.VERSION.SDK_INT >= 21) {
try {
final String[] languageFields = language.split("\\_");
newLocale = new Locale.Builder().setLanguage(languageFields[0]).setScript("").setRegion(languageFields[1]).build();
} catch (IllformedLocaleException e) {
} catch (RuntimeException e) {
// Falls back to "new Locale(language)"
}
}