Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Locale swedishLocale = new Locale("sv");
- // Check availability of language before trying to call speak()
- int languageAvailability = textToSpeech.isLanguageAvailable(swedishLocale);
- // These two return codes mean that either the TTS engine doesn't support a
- // language, or it does but is missing the voice data.
- if (languageAvailability == TextToSpeech.LANG_MISSING_DATA
- || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) {
- Timber.d("Language code %s is not supported on this device", language.getCode());
- // SpeechStatus is an enum I use to map TTS errors
- return SpeechStatus.ERROR_LANGUAGE_NOT_SUPPORTED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement