Show all languages supported in LatinImeGoogle in InputLanguageSelection

Bug: 4311203
Change-Id: I7a94e9697758cb79743c026e7f1c023f618a9aa1
main
satok 2011-04-18 20:23:39 +09:00
parent bc3dba451a
commit 88808fcdd4
1 changed files with 30 additions and 24 deletions

View File

@ -162,36 +162,42 @@ public class InputLanguageSelection extends PreferenceActivity {
for (int i = 0 ; i < origSize; i++ ) { for (int i = 0 ; i < origSize; i++ ) {
String s = locales[i]; String s = locales[i];
int len = s.length(); int len = s.length();
String language = "";
String country = "";
if (len == 5) { if (len == 5) {
String language = s.substring(0, 2); language = s.substring(0, 2);
String country = s.substring(3, 5); country = s.substring(3, 5);
Locale l = new Locale(language, country); } else if (len < 5) {
language = s;
}
Locale l = new Locale(language, country);
// Exclude languages that are not relevant to LatinIME // Exclude languages that are not relevant to LatinIME
if (arrayContains(BLACKLIST_LANGUAGES, language)) continue; if (arrayContains(BLACKLIST_LANGUAGES, language) || TextUtils.isEmpty(language)) {
continue;
}
if (finalSize == 0) { if (finalSize == 0) {
preprocess[finalSize++] =
new Loc(SubtypeSwitcher.getFullDisplayName(l, true), l);
} else {
// check previous entry:
// same lang and a country -> upgrade to full name and
// insert ours with full name
// diff lang -> insert ours with lang-only name
if (preprocess[finalSize-1].mLocale.getLanguage().equals(
language)) {
preprocess[finalSize-1].setLabel(SubtypeSwitcher.getFullDisplayName(
preprocess[finalSize-1].mLocale, false));
preprocess[finalSize++] = preprocess[finalSize++] =
new Loc(SubtypeSwitcher.getFullDisplayName(l, true), l); new Loc(SubtypeSwitcher.getFullDisplayName(l, false), l);
} else { } else {
// check previous entry: String displayName;
// same lang and a country -> upgrade to full name and if (s.equals("zz_ZZ")) {
// insert ours with full name // ignore this locale
// diff lang -> insert ours with lang-only name
if (preprocess[finalSize-1].mLocale.getLanguage().equals(
language)) {
preprocess[finalSize-1].setLabel(SubtypeSwitcher.getFullDisplayName(
preprocess[finalSize-1].mLocale, false));
preprocess[finalSize++] =
new Loc(SubtypeSwitcher.getFullDisplayName(l, false), l);
} else { } else {
String displayName; displayName = SubtypeSwitcher.getFullDisplayName(l, true);
if (s.equals("zz_ZZ")) { preprocess[finalSize++] = new Loc(displayName, l);
// ignore this locale
} else {
displayName = SubtypeSwitcher.getFullDisplayName(l, true);
preprocess[finalSize++] = new Loc(displayName, l);
}
} }
} }
} }