In the TTS settings: rely on the default locale rather than default

values stored in TextToSpeech.Engine to initialize the default TTS
country and variant.
This commit is contained in:
Jean-Michel Trivi
2009-07-07 17:08:32 -07:00
parent c4a3bf94cc
commit 00d4fbfc42

View File

@@ -191,8 +191,9 @@ public class TextToSpeechSettings extends PreferenceActivity implements
country = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_COUNTRY);
if (country == null) {
// default country setting not found, initialize it, as well as the variant;
country = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
variant = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
Locale currentLocale = Locale.getDefault();
country = currentLocale.getISO3Country();
variant = currentLocale.getVariant();
Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
}
@@ -203,7 +204,8 @@ public class TextToSpeechSettings extends PreferenceActivity implements
variant = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_VARIANT);
if (variant == null) {
// default variant setting not found, initialize it
variant = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
Locale currentLocale = Locale.getDefault();
variant = currentLocale.getVariant();
Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
}
}