diff --git a/android/src/com/reecedunn/espeak/SpeechSynthesis.java b/android/src/com/reecedunn/espeak/SpeechSynthesis.java index be052e33..cc041d79 100644 --- a/android/src/com/reecedunn/espeak/SpeechSynthesis.java +++ b/android/src/com/reecedunn/espeak/SpeechSynthesis.java @@ -135,18 +135,17 @@ public class SpeechSynthesis { final int gender = Integer.parseInt(results[i + 2]); final int age = Integer.parseInt(results[i + 3]); - final Locale locale; - if (identifier.equals("asia/fa-en-us")) { - locale = null; - } else { - locale = getLocaleFromLanguageName(name); - } - if (locale == null) { - Log.d(TAG, "getAvailableResources: skipping " + name + " => locale not supported"); - continue; - } - try { + final Locale locale; + if (identifier.equals("asia/fa-en-us")) { + throw new IllegalArgumentException("Voice '" + identifier + "' is a duplicate voice."); + } else { + locale = getLocaleFromLanguageName(name); + if (locale == null) { + throw new IllegalArgumentException("Locale not supported."); + } + } + String language = locale.getISO3Language(); if (language.equals("")) { throw new IllegalArgumentException("Language '" + locale.getLanguage() + "' not supported.");