catch IllformedLocaleException
This commit is contained in:
parent
79b5bbfbeb
commit
9ecf9c9b02
1 changed files with 6 additions and 2 deletions
|
@ -168,8 +168,12 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
|
|||
|
||||
//#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("\\_");
|
||||
final Locale newLocale = new Locale.Builder().setLanguage(languageFields[0]).setScript("").setRegion(languageFields[1]).build();
|
||||
} catch (IllformedLocaleException e) {
|
||||
final Locale newLocale = new Locale(language);
|
||||
}
|
||||
} else {
|
||||
final Locale newLocale = new Locale(language);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue