match also dash for backward compatibility

This commit is contained in:
sonora 2016-12-20 18:25:35 +01:00
parent 93ee2c6f4d
commit c1f957436f

View file

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