summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/LocalePicker.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:05 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:05 -0800
commit1feaa85791b3b5cc66a16142afc2259a2356bc9e (patch)
tree358b291b67f16adb85d6b4a9ce8be57303626a1b /src/com/android/settings/LocalePicker.java
parent590c0a97ff3b7665306e14da9a999212da5f06b9 (diff)
downloadpackages_apps_Settings-1feaa85791b3b5cc66a16142afc2259a2356bc9e.zip
packages_apps_Settings-1feaa85791b3b5cc66a16142afc2259a2356bc9e.tar.gz
packages_apps_Settings-1feaa85791b3b5cc66a16142afc2259a2356bc9e.tar.bz2
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'src/com/android/settings/LocalePicker.java')
-rw-r--r--src/com/android/settings/LocalePicker.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/com/android/settings/LocalePicker.java b/src/com/android/settings/LocalePicker.java
index 9ee8260..386d7e0 100644
--- a/src/com/android/settings/LocalePicker.java
+++ b/src/com/android/settings/LocalePicker.java
@@ -73,14 +73,14 @@ public class LocalePicker extends ListActivity {
int len = s.length();
if (len == 2) {
Locale l = new Locale(s);
- preprocess[finalSize++] = new Loc(l.getDisplayLanguage(), l);
+ preprocess[finalSize++] = new Loc(toTitleCase(l.getDisplayLanguage()), l);
} else if (len == 5) {
String language = s.substring(0, 2);
String country = s.substring(3, 5);
Locale l = new Locale(language, country);
if (finalSize == 0) {
- preprocess[finalSize++] = new Loc(l.getDisplayLanguage(), l);
+ preprocess[finalSize++] = new Loc(toTitleCase(l.getDisplayLanguage()), l);
} else {
// check previous entry:
// same lang and no country -> overwrite it with a lang-only name
@@ -91,17 +91,17 @@ public class LocalePicker extends ListActivity {
String prevCountry = preprocess[finalSize-1].locale.getCountry();
if (prevCountry.length() == 0) {
preprocess[finalSize-1].locale = l;
- preprocess[finalSize-1].label = l.getDisplayLanguage();
+ preprocess[finalSize-1].label = toTitleCase(l.getDisplayLanguage());
} else {
- preprocess[finalSize-1].label = preprocess[finalSize-1].locale.getDisplayName();
- preprocess[finalSize++] = new Loc(l.getDisplayName(), l);
+ preprocess[finalSize-1].label = toTitleCase(preprocess[finalSize-1].locale.getDisplayName());
+ preprocess[finalSize++] = new Loc(toTitleCase(l.getDisplayName()), l);
}
} else {
String displayName;
if (s.equals("zz_ZZ")) {
displayName = "Pseudo...";
} else {
- displayName = l.getDisplayLanguage();
+ displayName = toTitleCase(l.getDisplayLanguage());
}
preprocess[finalSize++] = new Loc(displayName, l);
}
@@ -118,6 +118,14 @@ public class LocalePicker extends ListActivity {
getListView().setAdapter(adapter);
}
+ private static String toTitleCase(String s) {
+ if (s.length() == 0) {
+ return s;
+ }
+
+ return Character.toUpperCase(s.charAt(0)) + s.substring(1);
+ }
+
@Override
public void onResume() {
super.onResume();