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:
@@ -191,8 +191,9 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
country = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_COUNTRY);
|
country = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_COUNTRY);
|
||||||
if (country == null) {
|
if (country == null) {
|
||||||
// default country setting not found, initialize it, as well as the variant;
|
// default country setting not found, initialize it, as well as the variant;
|
||||||
country = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
|
Locale currentLocale = Locale.getDefault();
|
||||||
variant = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
|
country = currentLocale.getISO3Country();
|
||||||
|
variant = currentLocale.getVariant();
|
||||||
Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
|
Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
|
||||||
Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
|
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);
|
variant = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_VARIANT);
|
||||||
if (variant == null) {
|
if (variant == null) {
|
||||||
// default variant setting not found, initialize it
|
// 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);
|
Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user