summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2015-12-03 19:18:45 +0000
committer android-build-merger <android-build-merger@google.com> 2015-12-03 19:18:45 +0000
commitd42df4f68e16bc3800d4d944caddbcbe79986fe8 (patch)
tree23a24c27715e54e72cb206589e6c9998ff42394b
parentd295e94dade5123354761c5f2577913799b5b2c5 (diff)
parent30e321b54a589d33dc7f2dd7344bef95faaaf83d (diff)
Merge "Fix special handling of a fake language code "tl"." am: 9fd2af6b32
am: 30e321b54a * commit '30e321b54a589d33dc7f2dd7344bef95faaaf83d': Fix special handling of a fake language code "tl".
-rw-r--r--core/java/com/android/internal/inputmethod/InputMethodUtils.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 742173b9b5b3..a5b20f5b367b 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -377,17 +377,17 @@ public class InputMethodUtils {
}
// TODO: Use {@link Locale#toLanguageTag()} and {@link Locale#forLanguageTag(languageTag)}.
String[] localeParams = localeStr.split("_", 3);
+ if (localeParams.length >= 1 && "tl".equals(localeParams[0])) {
+ // Convert a locale whose language is "tl" to one whose language is "fil".
+ // For example, "tl_PH" will get converted to "fil_PH".
+ // Versions of Android earlier than Lollipop did not support three letter language
+ // codes, and used "tl" (Tagalog) as the language string for "fil" (Filipino).
+ // On Lollipop and above, the current three letter version must be used.
+ localeParams[0] = "fil";
+ }
// The length of localeStr is guaranteed to always return a 1 <= value <= 3
// because localeStr is not empty.
if (localeParams.length == 1) {
- if (localeParams.length >= 1 && "tl".equals(localeParams[0])) {
- // Convert a locale whose language is "tl" to one whose language is "fil".
- // For example, "tl_PH" will get converted to "fil_PH".
- // Versions of Android earlier than Lollipop did not support three letter language
- // codes, and used "tl" (Tagalog) as the language string for "fil" (Filipino).
- // On Lollipop and above, the current three letter version must be used.
- localeParams[0] = "fil";
- }
return new Locale(localeParams[0]);
} else if (localeParams.length == 2) {
return new Locale(localeParams[0], localeParams[1]);