aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-05-06 09:44:57 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-06 09:44:57 -0700
commit90b73b85e4d1846b84f97fb3b1a5f7897f89b985 (patch)
treef86922f777649db45d82c09804308da87f4f30d6 /java/src
parentee8ac602e82affd7df1fcf4d5205138de85f431a (diff)
parent757c12556b5336cce4962b18967a0da20c871329 (diff)
downloadlatinime-90b73b85e4d1846b84f97fb3b1a5f7897f89b985.tar.gz
latinime-90b73b85e4d1846b84f97fb3b1a5f7897f89b985.tar.xz
latinime-90b73b85e4d1846b84f97fb3b1a5f7897f89b985.zip
Merge "Get subtype name string resource from its own locale" into jb-dev
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/SubtypeLocale.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/SubtypeLocale.java b/java/src/com/android/inputmethod/latin/SubtypeLocale.java
index 9f89f9ee1..7694b56fc 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeLocale.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeLocale.java
@@ -22,6 +22,8 @@ import android.content.Context;
import android.content.res.Resources;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
+
import java.util.HashMap;
import java.util.Locale;
@@ -121,18 +123,27 @@ public class SubtypeLocale {
// fr azerty F Français
// fr_CA qwerty F Français (Canada)
// de qwertz F Deutsch
- // zz qwerty F No language (QWERTY)
+ // zz qwerty F No language (QWERTY) in system locale
// fr qwertz T Français (QWERTZ)
// de qwerty T Deutsch (QWERTY)
// en_US azerty T English (US) (AZERTY)
- // zz azerty T No language (AZERTY)
+ // zz azerty T No language (AZERTY) in system locale
public static String getSubtypeDisplayName(InputMethodSubtype subtype, Resources res) {
// TODO: Remove this check when InputMethodManager.getLastInputMethodSubtype is
// fixed.
if (!ImfUtils.checkIfSubtypeBelongsToThisIme(sContext, subtype)) return "";
final String language = getSubtypeLocaleDisplayName(subtype.getLocale());
- return res.getString(subtype.getNameResId(), language);
+ final int nameResId = subtype.getNameResId();
+ final RunInLocale<String> getSubtypeName = new RunInLocale<String>() {
+ @Override
+ protected String job(Resources res) {
+ return res.getString(nameResId, language);
+ }
+ };
+ final Locale locale = isNoLanguage(subtype)
+ ? res.getConfiguration().locale : getSubtypeLocale(subtype);
+ return getSubtypeName.runInLocale(res, locale);
}
public static boolean isNoLanguage(InputMethodSubtype subtype) {