summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jean-Michel Trivi <jmtrivi@google.com> 2009-07-06 17:58:52 -0700
committer Jean-Michel Trivi <jmtrivi@google.com> 2009-07-06 18:02:08 -0700
commitd478cf09dff93015bc332f2707068f08bf603cfd (patch)
treebf8cb351c1638614601517deaab98586fc54b21d
parent870e09fcd2dfdc12ac318962efd28b0420c562bb (diff)
Use the current Locale as the default language when TTS settings are not
found, rather than a hardcoded value stored in TextToSpeech.Engine.
-rwxr-xr-xpackages/TtsService/src/android/tts/TtsService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 0bed72bd7ba2..10f4d6ecfaca 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -36,6 +36,7 @@ import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Locale;
import java.util.concurrent.locks.ReentrantLock;
/**
@@ -183,7 +184,8 @@ public class TtsService extends Service implements OnCompletionListener {
String defaultLang = android.provider.Settings.Secure.getString(mResolver,
android.provider.Settings.Secure.TTS_DEFAULT_LANG);
if (defaultLang == null) {
- return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG;
+ // no setting found, use the current Locale to determine the default language
+ return Locale.getDefault().getISO3Language();
} else {
return defaultLang;
}
@@ -194,7 +196,8 @@ public class TtsService extends Service implements OnCompletionListener {
String defaultCountry = android.provider.Settings.Secure.getString(mResolver,
android.provider.Settings.Secure.TTS_DEFAULT_COUNTRY);
if (defaultCountry == null) {
- return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
+ // no setting found, use the current Locale to determine the default country
+ return Locale.getDefault().getISO3Country();
} else {
return defaultCountry;
}
@@ -205,7 +208,8 @@ public class TtsService extends Service implements OnCompletionListener {
String defaultVar = android.provider.Settings.Secure.getString(mResolver,
android.provider.Settings.Secure.TTS_DEFAULT_VARIANT);
if (defaultVar == null) {
- return TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
+ // no setting found, use the current Locale to determine the default variant
+ return Locale.getDefault().getVariant();
} else {
return defaultVar;
}