From e422c94634da4d0e61a9106addebf06cbcf70c2e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 14 Feb 2014 11:01:38 +0900 Subject: [PATCH] Fix test resource declarations and parsing a bit Change-Id: I882a41b2934c48f4405f1ea5bf4d6ad41e87322c --- java/res/xml-sw600dp/key_styles_common.xml | 2 +- java/res/xml/key_styles_common.xml | 2 +- .../values-ar/donottranslate-more-keys.xml | 4 ++-- .../values-ca/donottranslate-more-keys.xml | 4 ++-- .../values-es/donottranslate-more-keys.xml | 2 +- .../values-fa/donottranslate-more-keys.xml | 4 ++-- .../values-hi/donottranslate-more-keys.xml | 2 +- .../donottranslate-more-keys.xml | 2 +- .../res/values/donottranslate-more-keys.xml | 14 +++++++------- .../keyboard/tools/MoreKeysResources.java | 19 ++----------------- 10 files changed, 20 insertions(+), 35 deletions(-) diff --git a/java/res/xml-sw600dp/key_styles_common.xml b/java/res/xml-sw600dp/key_styles_common.xml index 6a79c6fc2..aa64f85b3 100644 --- a/java/res/xml-sw600dp/key_styles_common.xml +++ b/java/res/xml-sw600dp/key_styles_common.xml @@ -161,7 +161,7 @@ latin:parentStyle="baseForLayoutSwitchKeyStyle" /> diff --git a/java/res/xml/key_styles_common.xml b/java/res/xml/key_styles_common.xml index f04fc45bb..2330ecb7f 100644 --- a/java/res/xml/key_styles_common.xml +++ b/java/res/xml/key_styles_common.xml @@ -149,7 +149,7 @@ latin:parentStyle="baseForLayoutSwitchKeyStyle" /> diff --git a/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml index 9b0a05945..d9976858a 100644 --- a/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml @@ -75,7 +75,7 @@ ٪ - \?,¿ + ?,¿ ; \\%,‰ @@ -85,7 +85,7 @@ "،" "؟" "!fixedColumnOrder!4,:,!,؟,؛,-,/,\",\'" - "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|(" + "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,@,&,\\%,+,؛,/,(|),)|(" l·l,ł - "!fixedColumnOrder!9,;,/,(,),#,·,!,\\,,\?,&,\\%,+,\",-,:,',\@" - "!fixedColumnOrder!8,;,/,(,),#,·,',\\,,&,\\%,+,\",-,:,\@" + "!fixedColumnOrder!9,;,/,(,),#,·,!,\\,,?,&,\\%,+,\",-,:,',@" + "!fixedColumnOrder!8,;,/,(,),#,·,',\\,,&,\\%,+,\",-,:,@" ç diff --git a/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml index f4fe7f787..453d5c196 100644 --- a/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml @@ -69,5 +69,5 @@ ç,ć,č - "!fixedColumnOrder!9,¡,;,/,(,),#,!,\\,,\?,¿,&,\\%,+,\",-,:,',\@" + "!fixedColumnOrder!9,¡,;,/,(,),#,!,\\,,?,¿,&,\\%,+,\",-,:,',@" diff --git a/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml index 3f12784e5..6ea04338e 100644 --- a/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml @@ -75,7 +75,7 @@ ٪ - \?,¿ + ?,¿ ; \\%,‰ @@ -92,7 +92,7 @@ - "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis" + "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,@,&,\\%,+,؛,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis" - \?१२३ + ?१२३ १२३ diff --git a/tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml index 9205e5309..e92a87e19 100644 --- a/tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml @@ -44,7 +44,7 @@ - \?१२३ + ?१२३ १२३ diff --git a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml index 8d3d61c72..c2f0938a0 100644 --- a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml @@ -83,8 +83,8 @@ ¢,£,€,¥,₱ $ $,¢,€,£,¥,₱ - "!fixedColumnOrder!8,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,!,\\,,\?,&,\\%,+,\",-,:,',\@" - "!fixedColumnOrder!7,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,',\\,,&,\\%,+,\",-,:,\@" + "!fixedColumnOrder!8,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,!,\\,,?,&,\\%,+,\",-,:,',@" + "!fixedColumnOrder!7,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,',\\,,&,\\%,+,\",-,:,@" ñ - \?123 + ?123 123 @@ -189,7 +189,7 @@ . !text/more_keys_for_tablet_punctuation - \? + ? ; % @@ -205,11 +205,11 @@ w y x - !fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm + !fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm !icon/settings_key|!code/key_settings !icon/shortcut_key|!code/key_shortcut - !hasLabels!,\@string/label_next_key|!code/key_action_next - !hasLabels!,\@string/label_previous_key|!code/key_action_previous + !hasLabels!,!text/label_next_key|!code/key_action_next + !hasLabels!,!text/label_previous_key|!code/key_action_previous = \\\\ < diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java index 872ef19e3..e9d6c864f 100644 --- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java @@ -29,6 +29,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Locale; import java.util.jar.JarFile; +import java.util.regex.Pattern; public class MoreKeysResources { private static final String TEXT_RESOURCE_NAME = "donottranslate-more-keys.xml"; @@ -287,23 +288,7 @@ public class MoreKeysResources { sb.append(String.format("\\u%04X", (int)c)); } } - return replaceIncompatibleEscape(sb.toString()); - } - - private static String replaceIncompatibleEscape(final String text) { - String t = text; - t = replaceAll(t, "\\?", "?"); - t = replaceAll(t, "\\@", "@"); - t = replaceAll(t, "@string/", "!text/"); - return t; - } - - private static String replaceAll(final String text, final String target, final String replace) { - String t = text; - while (t.indexOf(target) >= 0) { - t = t.replace(target, replace); - } - return t; + return sb.toString(); } private static void close(final Closeable stream) {