Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00d4fbfc authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

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.
parent c4a3bf94
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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);
            }
        }