am ab6552c3: Make sure the TTS example in the TTS Settings loads a supported language. This fixes the issue where the example wouldn\'t play when the UI is in Japanese in bug 2088099.

Merge commit 'ab6552c3f01f893ca927fc8ef0fec95a6c8f178f' into eclair-plus-aosp

* commit 'ab6552c3f01f893ca927fc8ef0fec95a6c8f178f':
  Make sure the TTS example in the TTS Settings loads a supported language.
This commit is contained in:
Jean-Michel Trivi
2009-09-01 16:17:44 -07:00
committed by Android Git Automerger

View File

@@ -265,6 +265,12 @@ public class TextToSpeechSettings extends PreferenceActivity implements
if (status == TextToSpeech.SUCCESS) {
Log.v(TAG, "TTS engine for settings screen initialized.");
mEnableDemo = true;
// check to see if the current locale is supported
if (mTts.isLanguageAvailable(Locale.getDefault()) == TextToSpeech.LANG_NOT_SUPPORTED) {
mTts.setLanguage(Locale.US);
} else {
mTts.setLanguage(Locale.getDefault());
}
} else {
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
mEnableDemo = false;
@@ -282,7 +288,6 @@ public class TextToSpeechSettings extends PreferenceActivity implements
Log.v(TAG, "Voice data check passed");
if (mTts == null) {
mTts = new TextToSpeech(this, this);
mTts.setLanguage(Locale.getDefault());
}
} else {
Log.v(TAG, "Voice data check failed");