Fix test resource declarations and parsing a bit
Change-Id: I882a41b2934c48f4405f1ea5bf4d6ad41e87322c
This commit is contained in:
parent
d4469756be
commit
e422c94634
10 changed files with 20 additions and 35 deletions
|
@ -161,7 +161,7 @@
|
|||
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
|
||||
<key-style
|
||||
latin:styleName="comKeyStyle"
|
||||
latin:keySpec="!text/keylabel_for_popular_domain|!text/keylabel_for_popular_domain"
|
||||
latin:keySpec="!text/keylabel_for_popular_domain"
|
||||
latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
|
||||
latin:moreKeys="!text/more_keys_for_popular_domain" />
|
||||
</merge>
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
latin:parentStyle="baseForLayoutSwitchKeyStyle" />
|
||||
<key-style
|
||||
latin:styleName="comKeyStyle"
|
||||
latin:keySpec="!text/keylabel_for_popular_domain|!text/keylabel_for_popular_domain"
|
||||
latin:keySpec="!text/keylabel_for_popular_domain"
|
||||
latin:keyLabelFlags="autoXScale|fontNormal|hasPopupHint|preserveCase"
|
||||
latin:moreKeys="!text/more_keys_for_popular_domain"
|
||||
latin:backgroundType="functional" />
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
|
||||
<string name="keylabel_for_symbols_percent">٪</string>
|
||||
<!-- U+00BF: "¿" INVERTED QUESTION MARK -->
|
||||
<string name="more_keys_for_question">\?,¿</string>
|
||||
<string name="more_keys_for_question">?,¿</string>
|
||||
<string name="more_keys_for_symbols_semicolon">;</string>
|
||||
<!-- U+2030: "‰" PER MILLE SIGN -->
|
||||
<string name="more_keys_for_symbols_percent">\\%,‰</string>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<string name="keylabel_for_tablet_comma">"،"</string>
|
||||
<string name="keyhintlabel_for_tablet_comma">"؟"</string>
|
||||
<string name="more_keys_for_tablet_comma">"!fixedColumnOrder!4,:,!,؟,؛,-,/,\",\'"</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|("</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,@,&,\\%,+,؛,/,(|),)|("</string>
|
||||
<!-- U+266A: "♪" EIGHTH NOTE -->
|
||||
<string name="more_keys_for_bullet">♪</string>
|
||||
<!-- U+2605: "★" BLACK STAR
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
U+0142: "ł" LATIN SMALL LETTER L WITH STROKE -->
|
||||
<string name="more_keys_for_l">l·l,ł</string>
|
||||
<!-- U+00B7: "·" MIDDLE DOT -->
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!9,;,/,(,),#,·,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string>
|
||||
<string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!8,;,/,(,),#,·,',\\,,&,\\%,+,\",-,:,\@"</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!9,;,/,(,),#,·,!,\\,,?,&,\\%,+,\",-,:,',@"</string>
|
||||
<string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!8,;,/,(,),#,·,',\\,,&,\\%,+,\",-,:,@"</string>
|
||||
<!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA -->
|
||||
<string name="keylabel_for_spanish_row2_10">ç</string>
|
||||
</resources>
|
||||
|
|
|
@ -69,5 +69,5 @@
|
|||
<string name="more_keys_for_c">ç,ć,č</string>
|
||||
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK
|
||||
U+00BF: "¿" INVERTED QUESTION MARK -->
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!9,¡,;,/,(,),#,!,\\,,\?,¿,&,\\%,+,\",-,:,',\@"</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!9,¡,;,/,(,),#,!,\\,,?,¿,&,\\%,+,\",-,:,',@"</string>
|
||||
</resources>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
|
||||
<string name="keylabel_for_symbols_percent">٪</string>
|
||||
<!-- U+00BF: "¿" INVERTED QUESTION MARK -->
|
||||
<string name="more_keys_for_question">\?,¿</string>
|
||||
<string name="more_keys_for_question">?,¿</string>
|
||||
<string name="more_keys_for_symbols_semicolon">;</string>
|
||||
<!-- U+2030: "‰" PER MILLE SIGN -->
|
||||
<string name="more_keys_for_symbols_percent">\\%,‰</string>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<!-- U+061F: "؟" ARABIC QUESTION MARK
|
||||
U+060C: "،" ARABIC COMMA
|
||||
U+061B: "؛" ARABIC SEMICOLON -->
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis"</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,@,&,\\%,+,؛,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis"</string>
|
||||
<!-- U+266A: "♪" EIGHTH NOTE -->
|
||||
<string name="more_keys_for_bullet">♪</string>
|
||||
<!-- U+2605: "★" BLACK STAR
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<!-- U+0966: "०" DEVANAGARI DIGIT ZERO -->
|
||||
<string name="keylabel_for_symbols_0">०</string>
|
||||
<!-- Label for "switch to symbols" key. -->
|
||||
<string name="label_to_symbol_key">\?१२३</string>
|
||||
<string name="label_to_symbol_key">?१२३</string>
|
||||
<!-- Label for "switch to symbols with microphone" key. This string shouldn't include the "mic"
|
||||
part because it'll be appended by the code. -->
|
||||
<string name="label_to_symbol_with_microphone_key">१२३</string>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<!-- U+0966: "०" DEVANAGARI DIGIT ZERO -->
|
||||
<string name="keylabel_for_symbols_0">०</string>
|
||||
<!-- Label for "switch to symbols" key. -->
|
||||
<string name="label_to_symbol_key">\?१२३</string>
|
||||
<string name="label_to_symbol_key">?१२३</string>
|
||||
<!-- Label for "switch to symbols with microphone" key. This string shouldn't include the "mic"
|
||||
part because it'll be appended by the code. -->
|
||||
<string name="label_to_symbol_with_microphone_key">१२३</string>
|
||||
|
|
|
@ -83,8 +83,8 @@
|
|||
<string name="more_keys_for_currency_dollar">¢,£,€,¥,₱</string>
|
||||
<string name="keylabel_for_currency">$</string>
|
||||
<string name="more_keys_for_currency">$,¢,€,£,¥,₱</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string>
|
||||
<string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!7,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,',\\,,&,\\%,+,\",-,:,\@"</string>
|
||||
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,!,\\,,?,&,\\%,+,\",-,:,',@"</string>
|
||||
<string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!7,;,/,!text/keyspec_left_parenthesis,!text/keyspec_right_parenthesis,#,',\\,,&,\\%,+,\",-,:,@"</string>
|
||||
<!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
|
||||
<string name="keylabel_for_spanish_row2_10">ñ</string>
|
||||
<!-- U+2020: "†" DAGGER
|
||||
|
@ -115,7 +115,7 @@
|
|||
<string name="keylabel_for_symbols_9">9</string>
|
||||
<string name="keylabel_for_symbols_0">0</string>
|
||||
<!-- Label for "switch to symbols" key. -->
|
||||
<string name="label_to_symbol_key">\?123</string>
|
||||
<string name="label_to_symbol_key">?123</string>
|
||||
<!-- Label for "switch to symbols with microphone" key. This string shouldn't include the "mic"
|
||||
part because it'll be appended by the code. -->
|
||||
<string name="label_to_symbol_with_microphone_key">123</string>
|
||||
|
@ -189,7 +189,7 @@
|
|||
<string name="keylabel_for_tablet_period">.</string>
|
||||
<string name="keyhintlabel_for_tablet_period"></string>
|
||||
<string name="more_keys_for_tablet_period">!text/more_keys_for_tablet_punctuation</string>
|
||||
<string name="keylabel_for_symbols_question">\?</string>
|
||||
<string name="keylabel_for_symbols_question">?</string>
|
||||
<string name="keylabel_for_symbols_semicolon">;</string>
|
||||
<string name="keylabel_for_symbols_percent">%</string>
|
||||
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK -->
|
||||
|
@ -205,11 +205,11 @@
|
|||
<string name="keylabel_for_w">w</string>
|
||||
<string name="keylabel_for_y">y</string>
|
||||
<string name="keylabel_for_x">x</string>
|
||||
<string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm</string>
|
||||
<string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm</string>
|
||||
<string name="settings_as_more_key">!icon/settings_key|!code/key_settings</string>
|
||||
<string name="shortcut_as_more_key">!icon/shortcut_key|!code/key_shortcut</string>
|
||||
<string name="action_next_as_more_key">!hasLabels!,\@string/label_next_key|!code/key_action_next</string>
|
||||
<string name="action_previous_as_more_key">!hasLabels!,\@string/label_previous_key|!code/key_action_previous</string>
|
||||
<string name="action_next_as_more_key">!hasLabels!,!text/label_next_key|!code/key_action_next</string>
|
||||
<string name="action_previous_as_more_key">!hasLabels!,!text/label_previous_key|!code/key_action_previous</string>
|
||||
<!-- Label for "switch to more symbol" modifier key ("= \ <"). Must be short to fit on key! -->
|
||||
<string name="label_to_more_symbol_key">= \\\\ <</string>
|
||||
<!-- Label for "switch to more symbol" modifier key on tablets. Must be short to fit on key! -->
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue