From f5ef30dfc6f4e436d35c38b6f7e32fbd24d54aab Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 9 Sep 2011 20:54:43 +0900 Subject: Have the spell checker honor case Bug: 5281103 Change-Id: I415c84dbb55f1eeb5deb9f248b4056881982ee13 --- java/src/com/android/inputmethod/latin/Utils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/Utils.java') diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 6263ebefa..c35273edd 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -757,10 +757,19 @@ public class Utils { return toTitleCase(locale.getLanguage(), locale); } - private static String toTitleCase(String s, Locale locale) { + public static String toTitleCase(String s, Locale locale) { if (s.length() <= 1) { + // TODO: is this really correct? Shouldn't this be s.toUpperCase()? return s; } + // TODO: fix the bugs below + // - This does not work for Greek, because it returns upper case instead of title case. + // - It does not work for Serbian, because it fails to account for the "lj" character, + // which should be "Lj" in title case and "LJ" in upper case. + // - It does not work for Dutch, because it fails to account for the "ij" digraph, which + // are two different characters but both should be capitalized as "IJ" as if they were + // a single letter. + // - It also does not work with unicode surrogate code points. return s.toUpperCase(locale).charAt(0) + s.substring(1); } } -- cgit v1.2.3-83-g751a