Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Locale swedishLocale = new Locale("sv");
  2.  
  3. // Check availability of language before trying to call speak()
  4. int languageAvailability = textToSpeech.isLanguageAvailable(swedishLocale);
  5.  
  6. // These two return codes mean that either the TTS engine doesn't support a
  7. // language, or it does but is missing the voice data.
  8. if (languageAvailability == TextToSpeech.LANG_MISSING_DATA
  9. || languageAvailability == TextToSpeech.LANG_NOT_SUPPORTED) {
  10. Timber.d("Language code %s is not supported on this device", language.getCode());
  11.  
  12. // SpeechStatus is an enum I use to map TTS errors
  13. return SpeechStatus.ERROR_LANGUAGE_NOT_SUPPORTED;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement