diff options
Diffstat (limited to 'tools/make-keyboard-text')
24 files changed, 505 insertions, 335 deletions
diff --git a/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl deleted file mode 100644 index 4cd9c236b..000000000 --- a/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.keyboard.internal; - -import android.content.Context; -import android.content.res.Resources; - -import com.android.inputmethod.annotations.UsedForTesting; -import com.android.inputmethod.latin.utils.CollectionUtils; - -import java.util.HashMap; - -/** - * !!!!! DO NOT EDIT THIS FILE !!!!! - * - * This file is generated by tools/make-keyboard-text. The base template file is - * tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl - * - * This file must be updated when any text resources in keyboard layout files have been changed. - * These text resources are referred as "!text/<resource_name>" in keyboard XML definitions, - * and should be defined in - * tools/make-keyboard-text/res/values-<locale>/donottranslate-more-keys.xml - * - * To update this file, please run the following commands. - * $ cd $ANDROID_BUILD_TOP - * $ mmm packages/inputmethods/LatinIME/tools/make-keyboard-text - * $ make-keyboard-text -java packages/inputmethods/LatinIME/java/src - * - * The updated source file will be generated to the following path (this file). - * packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/internal/ - * KeyboardTextsSet.java - */ -public final class KeyboardTextsSet { - // Language to texts map. - private static final HashMap<String, String[]> sLocaleToTextsMap = CollectionUtils.newHashMap(); - private static final HashMap<String, Integer> sNameToIdsMap = CollectionUtils.newHashMap(); - - private String[] mTexts; - // Resource name to text map. - private HashMap<String, String> mResourceNameToTextsMap = CollectionUtils.newHashMap(); - - public void setLanguage(final String language) { - mTexts = sLocaleToTextsMap.get(language); - if (mTexts == null) { - mTexts = LANGUAGE_DEFAULT; - } - } - - public void loadStringResources(final Context context) { - final int referenceId = context.getApplicationInfo().labelRes; - loadStringResourcesInternal(context, RESOURCE_NAMES, referenceId); - } - - @UsedForTesting - void loadStringResourcesInternal(final Context context, final String[] resourceNames, - final int referenceId) { - final Resources res = context.getResources(); - final String packageName = res.getResourcePackageName(referenceId); - for (final String resName : resourceNames) { - final int resId = res.getIdentifier(resName, "string", packageName); - mResourceNameToTextsMap.put(resName, res.getString(resId)); - } - } - - public String getText(final String name) { - String text = mResourceNameToTextsMap.get(name); - if (text != null) { - return text; - } - final Integer id = sNameToIdsMap.get(name); - if (id == null) throw new RuntimeException("Unknown label: " + name); - text = (id < mTexts.length) ? mTexts[id] : null; - return (text == null) ? LANGUAGE_DEFAULT[id] : text; - } - - private static final String[] RESOURCE_NAMES = { - // These texts' name should be aligned with the @string/<name> in values/strings.xml. - // Labels for action. - "label_go_key", - // "label_search_key", - "label_send_key", - "label_next_key", - "label_done_key", - "label_previous_key", - // Other labels. - "label_pause_key", - "label_wait_key", - }; - - private static final String[] NAMES = { - /* @NAMES@ */ - }; - - private static final String EMPTY = ""; - - /* Default texts */ - private static final String[] LANGUAGE_DEFAULT = { - /* @DEFAULT_TEXTS@ */ - }; - - /* @TEXTS@ */ - private static final Object[] LANGUAGES_AND_TEXTS = { - /* @LANGUAGES_AND_TEXTS@ */ - }; - - static { - int id = 0; - for (final String name : NAMES) { - sNameToIdsMap.put(name, id++); - } - - for (int i = 0; i < LANGUAGES_AND_TEXTS.length; i += 2) { - final String language = (String)LANGUAGES_AND_TEXTS[i]; - final String[] texts = (String[])LANGUAGES_AND_TEXTS[i + 1]; - sLocaleToTextsMap.put(language, texts); - } - } -} diff --git a/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl new file mode 100644 index 000000000..b25bfb204 --- /dev/null +++ b/tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.tmpl @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.internal; + +import com.android.inputmethod.latin.utils.CollectionUtils; + +import java.util.HashMap; + +/** + * !!!!! DO NOT EDIT THIS FILE !!!!! + * + * This file is generated by tools/make-keyboard-text. The base template file is + * tools/make-keyboard-text/res/src/com/android/inputmethod/keyboard/internal/ + * KeyboardTextsTable.tmpl + * + * This file must be updated when any text resources in keyboard layout files have been changed. + * These text resources are referred as "!text/<resource_name>" in keyboard XML definitions, + * and should be defined in + * tools/make-keyboard-text/res/values-<locale>/donottranslate-more-keys.xml + * + * To update this file, please run the following commands. + * $ cd $ANDROID_BUILD_TOP + * $ mmm packages/inputmethods/LatinIME/tools/make-keyboard-text + * $ make-keyboard-text -java packages/inputmethods/LatinIME/java + * + * The updated source file will be generated to the following path (this file). + * packages/inputmethods/LatinIME/java/src/com/android/inputmethod/keyboard/internal/ + * KeyboardTextsTable.java + */ +public final class KeyboardTextsTable { + // Name to index map. + private static final HashMap<String, Integer> sNameToIndexesMap = CollectionUtils.newHashMap(); + // Language to texts table map. + private static final HashMap<String, String[]> sLanguageToTextsTableMap = + CollectionUtils.newHashMap(); + // TODO: Remove this variable after debugging. + // Texts table to language maps. + private static final HashMap<String[], String> sTextsTableToLanguageMap = + CollectionUtils.newHashMap(); + + public static String getText(final String name, final String[] textsTable) { + final Integer indexObj = sNameToIndexesMap.get(name); + if (indexObj == null) { + throw new RuntimeException("Unknown text name=" + name + " language=" + + sTextsTableToLanguageMap.get(textsTable)); + } + final int index = indexObj; + final String text = (index < textsTable.length) ? textsTable[index] : null; + if (text != null) { + return text; + } + // Sanity check. + if (index >= 0 && index < LANGUAGE_DEFAULT.length) { + return LANGUAGE_DEFAULT[index]; + } + // Throw exception for debugging purpose. + throw new RuntimeException("Illegal index=" + index + " for name=" + name + + " language=" + sTextsTableToLanguageMap.get(textsTable)); + } + + public static String[] getTextsTable(final String language) { + final String[] textsTable = sLanguageToTextsTableMap.get(language); + return textsTable != null ? textsTable : LANGUAGE_DEFAULT; + } + + private static final String[] NAMES = { + // /* index:histogram */ "name", + /* @NAMES@ */ + }; + + private static final String EMPTY = ""; + + /* Default texts */ + private static final String[] LANGUAGE_DEFAULT = { + /* @DEFAULT_TEXTS@ */ + }; + + /* @TEXTS@ */ + // TODO: Use the language + "_" + region representation for the locale string key. + // Currently we are dropping the region from the key. + private static final Object[] LANGUAGES_AND_TEXTS = { + // "locale", TEXT_ARRAY, /* numberOfNonNullText/lengthOf_TEXT_ARRAY localeName */ + /* @LANGUAGES_AND_TEXTS@ */ + }; + + static { + for (int index = 0; index < NAMES.length; index++) { + sNameToIndexesMap.put(NAMES[index], index); + } + + for (int i = 0; i < LANGUAGES_AND_TEXTS.length; i += 2) { + final String language = (String)LANGUAGES_AND_TEXTS[i]; + final String[] textsTable = (String[])LANGUAGES_AND_TEXTS[i + 1]; + sLanguageToTextsTableMap.put(language, textsTable); + sTextsTableToLanguageMap.put(textsTable, language); + } + } +} 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 8b86b1ba2..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 @@ -65,24 +65,27 @@ <!-- U+060C: "،" ARABIC COMMA --> <string name="keylabel_for_comma">،</string> <string name="more_keys_for_comma">"\\,"</string> + <!-- U+0651: "ّ" ARABIC SHADDA --> + <string name="keyhintlabel_for_period">ّ</string> + <string name="more_keys_for_period">!text/more_keys_for_arabic_diacritics</string> + <string name="keyhintlabel_for_tablet_period">ّ</string> + <string name="more_keys_for_tablet_period">!text/more_keys_for_arabic_diacritics</string> <string name="keylabel_for_symbols_question">؟</string> <string name="keylabel_for_symbols_semicolon">؛</string> <!-- U+066A: "٪" ARABIC PERCENT SIGN --> <string name="keylabel_for_symbols_percent">٪</string> - <string name="more_keys_for_symbols_question">\?</string> + <!-- U+00BF: "¿" INVERTED QUESTION MARK --> + <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> - <!-- U+060C: "،" ARABIC COMMA - U+061B: "؛" ARABIC SEMICOLON - U+061F: "؟" ARABIC QUESTION MARK --> - <string name="keylabel_for_apostrophe">،</string> - <string name="keyhintlabel_for_apostrophe">؟</string> <!-- U+061F: "؟" ARABIC QUESTION MARK U+060C: "،" ARABIC COMMA U+061B: "؛" ARABIC SEMICOLON --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|("</string> - <string name="more_keys_for_apostrophe">"؟,؛,!,:,-,/,\',\""</string> + <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> <!-- U+266A: "♪" EIGHTH NOTE --> <string name="more_keys_for_bullet">♪</string> <!-- U+2605: "★" BLACK STAR @@ -92,18 +95,28 @@ http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> <!-- U+FD3E: "﴾" ORNATE LEFT PARENTHESIS U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS --> - <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,<|>,{|},[|]</string> - <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[</string> + <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,!text/keyspecs_for_left_parenthesis_more_keys</string> + <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,!text/keyspecs_for_right_parenthesis_more_keys</string> <!-- U+2264: "≤" LESS-THAN OR EQUAL TO U+2265: "≥" GREATER-THAN EQUAL TO U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK --> - <string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,«|»</string> - <string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,»|«</string> - <string name="single_angle_quotes">!text/single_laqm_raqm_rtl</string> - <string name="double_angle_quotes">!text/double_laqm_raqm_rtl</string> + <string name="keyspec_left_parenthesis">(|)</string> + <string name="keyspec_right_parenthesis">)|(</string> + <string name="keyspec_left_square_bracket">[|]</string> + <string name="keyspec_right_square_bracket">]|[</string> + <string name="keyspec_left_curly_bracket">{|}</string> + <string name="keyspec_right_curly_bracket">}|{</string> + <string name="keyspec_less_than"><|></string> + <string name="keyspec_greater_than">>|<</string> + <string name="keyspec_less_than_equal">≤|≥</string> + <string name="keyspec_greater_than_equal">≥|≤</string> + <string name="keyspec_left_double_angle_quote">«|»</string> + <string name="keyspec_right_double_angle_quote">»|«</string> + <string name="keyspec_left_single_angle_quote">‹|›</string> + <string name="keyspec_right_single_angle_quote">›|‹</string> <!-- U+0655: "ٕ" ARABIC HAMZA BELOW U+0654: "ٔ" ARABIC HAMZA ABOVE U+0652: "ْ" ARABIC SUKUN @@ -121,5 +134,4 @@ <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. --> <!-- Note: The space character is needed as a preceding letter to draw Arabic diacritics characters correctly. --> <string name="more_keys_for_arabic_diacritics">"!fixedColumnOrder!7, ٕ|ٕ, ٔ|ٔ, ْ|ْ, ٍ|ٍ, ٌ|ٌ, ً|ً, ّ|ّ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ِ|ِ, ُ|ُ, َ|َ,ـــ|ـ"</string> - <string name="keyhintlabel_for_arabic_diacritics">ّ</string> </resources> diff --git a/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-az-rAZ/donottranslate-more-keys.xml index db1784c17..db1784c17 100644 --- a/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-az-rAZ/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-be-rBY/donottranslate-more-keys.xml index 4723503f1..4723503f1 100644 --- a/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-be-rBY/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml index 66393732c..8865a6057 100644 --- a/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml @@ -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_period">\?,·</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> diff --git a/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml index 9dc8717ec..bb8bb7201 100644 --- a/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml @@ -55,6 +55,18 @@ <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE --> <string name="more_keys_for_n">ñ,ń</string> + <!-- U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS --> + <string name="keylabel_for_swiss_row1_11">ü</string> + <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE --> + <string name="more_keys_for_swiss_row1_11">è</string> + <!-- U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS --> + <string name="keylabel_for_swiss_row2_10">ö</string> + <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE --> + <string name="more_keys_for_swiss_row2_10">é</string> + <!-- U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS --> + <string name="keylabel_for_swiss_row2_11">ä</string> + <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE --> + <string name="more_keys_for_swiss_row2_11">à</string> <string name="single_quotes">!text/single_9qm_lqm</string> <string name="double_quotes">!text/double_9qm_lqm</string> <string name="single_angle_quotes">!text/single_raqm_laqm</string> 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 8e6b4ee06..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 @@ -67,16 +67,7 @@ U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE U+010D: "č" LATIN SMALL LETTER C WITH CARON --> <string name="more_keys_for_c">ç,ć,č</string> - <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE --> - <string name="keylabel_for_spanish_row2_10">ñ</string> <!-- U+00A1: "¡" INVERTED EXCLAMATION MARK U+00BF: "¿" INVERTED QUESTION MARK --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!4,;,!,\\,,\?,:,¡,\@,¿"</string> - <!-- U+00A1: "¡" INVERTED EXCLAMATION MARK --> - <string name="more_keys_for_tablet_comma">"!,¡"</string> - <!-- U+00BF: "¿" INVERTED QUESTION MARK --> - <string name="more_keys_for_period">"\?,¿"</string> - <string name="keylabel_for_apostrophe">\"</string> - <string name="keyhintlabel_for_apostrophe">\'</string> - <string name="more_keys_for_apostrophe">\'</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!9,¡,;,/,(,),#,!,\\,,?,¿,&,\\%,+,\",-,:,',@"</string> </resources> diff --git a/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-et-rEE/donottranslate-more-keys.xml index d037044bd..d037044bd 100644 --- a/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-et-rEE/donottranslate-more-keys.xml 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 ab4fbda44..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 @@ -65,11 +65,17 @@ <!-- U+060C: "،" ARABIC COMMA --> <string name="keylabel_for_comma">،</string> <string name="more_keys_for_comma">"\\,"</string> + <!-- U+064B: "ً" ARABIC FATHATAN --> + <string name="keyhintlabel_for_period">ً</string> + <string name="more_keys_for_period">!text/more_keys_for_arabic_diacritics</string> + <string name="keyhintlabel_for_tablet_period">ً</string> + <string name="more_keys_for_tablet_period">!text/more_keys_for_arabic_diacritics</string> <string name="keylabel_for_symbols_question">؟</string> <string name="keylabel_for_symbols_semicolon">؛</string> <!-- U+066A: "٪" ARABIC PERCENT SIGN --> <string name="keylabel_for_symbols_percent">٪</string> - <string name="more_keys_for_symbols_question">\?</string> + <!-- U+00BF: "¿" INVERTED QUESTION MARK --> + <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> @@ -79,19 +85,14 @@ U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK --> <string name="keylabel_for_tablet_comma">"،"</string> - <string name="keyhintlabel_for_tablet_comma">"!"</string> - <string name="more_keys_for_tablet_comma">"!,\\,"</string> - <string name="keyhintlabel_for_period">"؟"</string> - <string name="more_keys_for_period">"؟,\?"</string> - <string name="keylabel_for_apostrophe">،</string> - <string name="keyhintlabel_for_apostrophe">؟</string> - <string name="more_keys_for_apostrophe">"!fixedColumnOrder!4,:,!,؟,؛,-,/,«|»,»|«"</string> + <string name="keyhintlabel_for_tablet_comma">"؟"</string> + <string name="more_keys_for_tablet_comma">"!fixedColumnOrder!4,:,!,؟,؛,-,/,!text/keyspec_left_double_angle_quote,!text/keyspec_right_double_angle_quote"</string> <!-- U+FDFC: "﷼" RIAL SIGN --> <string name="keylabel_for_currency">﷼</string> <!-- U+061F: "؟" ARABIC QUESTION MARK U+060C: "،" ARABIC COMMA U+061B: "؛" ARABIC SEMICOLON --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|("</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 @@ -101,18 +102,30 @@ http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> <!-- U+FD3E: "﴾" ORNATE LEFT PARENTHESIS U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS --> - <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,<|>,{|},[|]</string> - <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[</string> + <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!4,﴾|﴿,!text/keyspecs_for_left_parenthesis_more_keys</string> + <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!4,﴿|﴾,!text/keyspecs_for_right_parenthesis_more_keys</string> <!-- U+2264: "≤" LESS-THAN OR EQUAL TO U+2265: "≥" GREATER-THAN EQUAL TO U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK --> - <string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,<|></string> - <string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,>|<</string> - <string name="single_angle_quotes">!text/single_laqm_raqm_rtl</string> - <string name="double_angle_quotes">!text/double_laqm_raqm_rtl</string> + <string name="more_keys_for_less_than">!fixedColumnOrder!3,!text/keyspec_left_single_angle_quote;,!text/keyspec_less_than_equal;,!text/keyspec_less_than</string> + <string name="more_keys_for_greater_than">!fixedColumnOrder!3,!text/keyspec_right_single_angle_quote;,!text/keyspec_greater_than_equal;,!text/keyspec_greater_than</string> + <string name="keyspec_left_parenthesis">(|)</string> + <string name="keyspec_right_parenthesis">)|(</string> + <string name="keyspec_left_square_bracket">[|]</string> + <string name="keyspec_right_square_bracket">]|[</string> + <string name="keyspec_left_curly_bracket">{|}</string> + <string name="keyspec_right_curly_bracket">}|{</string> + <string name="keyspec_less_than"><|></string> + <string name="keyspec_greater_than">>|<</string> + <string name="keyspec_less_than_equal">≤|≥</string> + <string name="keyspec_greater_than_equal">≥|≤</string> + <string name="keyspec_left_double_angle_quote">«|»</string> + <string name="keyspec_right_double_angle_quote">»|«</string> + <string name="keyspec_left_single_angle_quote">‹|›</string> + <string name="keyspec_right_single_angle_quote">›|‹</string> <!-- U+0655: "ٕ" ARABIC HAMZA BELOW U+0652: "ْ" ARABIC SUKUN U+0651: "ّ" ARABIC SHADDA @@ -130,5 +143,4 @@ <!-- In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label. --> <!-- Note: The space character is needed as a preceding letter to draw Arabic diacritics characters correctly. --> <string name="more_keys_for_arabic_diacritics">"!fixedColumnOrder!7, ٕ|ٕ, ْ|ْ, ّ|ّ, ٌ|ٌ, ٍ|ٍ, ً|ً, ٔ|ٔ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ُ|ُ, ِ|ِ, َ|َ,ـــ|ـ"</string> - <string name="keyhintlabel_for_arabic_diacritics">ً</string> </resources> diff --git a/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml index 7b11a183d..665677698 100644 --- a/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml @@ -65,4 +65,16 @@ <string name="more_keys_for_c">ç,ć,č</string> <!-- U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS --> <string name="more_keys_for_y">%,ÿ</string> + <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE --> + <string name="keylabel_for_swiss_row1_11">è</string> + <!-- U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS --> + <string name="more_keys_for_swiss_row1_11">ü</string> + <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE --> + <string name="keylabel_for_swiss_row2_10">é</string> + <!-- U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS --> + <string name="more_keys_for_swiss_row2_10">ö</string> + <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE --> + <string name="keylabel_for_swiss_row2_11">à</string> + <!-- U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS --> + <string name="more_keys_for_swiss_row2_11">ä</string> </resources> diff --git a/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml index b0d010f81..de10a010f 100644 --- a/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml @@ -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> diff --git a/tools/make-keyboard-text/res/values-hy/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hy-rAM/donottranslate-more-keys.xml index 2f34128bd..a17dc101d 100644 --- a/tools/make-keyboard-text/res/values-hy/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-hy-rAM/donottranslate-more-keys.xml @@ -18,6 +18,11 @@ */ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Label for "switch to alphabetic" key. + U+0531: "Ա" ARMENIAN CAPITAL LETTER AYB + U+0532: "Բ" ARMENIAN CAPITAL LETTER BEN + U+0533: "Գ" ARMENIAN CAPITAL LETTER GIM --> + <string name="label_to_alpha_key">ԱԲԳ</string> <!-- U+058A: "֊" ARMENIAN HYPHEN --> <!-- U+055C: "՜" ARMENIAN EXCLAMATION MARK --> <!-- U+055D: "՝" ARMENIAN COMMA --> @@ -26,15 +31,21 @@ <!-- U+055A: "՚" ARMENIAN APOSTROPHE --> <!-- U+055B: "՛" ARMENIAN EMPHASIS MARK --> <!-- U+055F: "՟" ARMENIAN ABBREVIATION MARK --> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,!,?,\\,,.,֊,՜,՝,՞,:,;,\@,ՙ,՚,՛,՟"</string> + <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,!,?,ՙ,՚,.,՜,\\,,՞,:,;,՟,«,»,֊,՝,՛"</string> <!-- U+055E: "՞" ARMENIAN QUESTION MARK --> <!-- U+00BF: "¿" INVERTED QUESTION MARK --> - <string name="more_keys_for_symbols_question">՞,¿</string> + <string name="more_keys_for_question">՞,¿</string> <!-- U+055C: "՜" ARMENIAN EXCLAMATION MARK --> <!-- U+00A1: "¡" INVERTED EXCLAMATION MARK --> - <string name="more_keys_for_symbols_exclamation">՜,¡</string> + <string name="more_keys_for_exclamation">՜,¡</string> <!-- U+058F: "֏" ARMENIAN DRAM SIGN --> <!-- TODO: Enable this when we have glyph for the following letter <string name="keylabel_for_currency">֏</string> --> + <!-- U+055D: "՝" ARMENIAN COMMA --> + <string name="keylabel_for_tablet_comma">՝</string> + <!-- U+0589: "։" ARMENIAN FULL STOP --> + <string name="keylabel_for_period">։</string> + <string name="keylabel_for_tablet_period">։</string> + <string name="more_keys_for_tablet_period">!text/more_keys_for_punctuation</string> </resources> diff --git a/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml index 994e35ae9..8314ae5da 100644 --- a/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml @@ -28,34 +28,30 @@ <!-- U+00B1: "±" PLUS-MINUS SIGN U+FB29: "﬩" HEBREW LETTER ALTERNATIVE PLUS SIGN --> <string name="more_keys_for_plus">±,﬩</string> - <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,(|),)|(,#,!,\\,,\?,&,\\%,+,\",-,:,',\@"</string> <!-- The all letters need to be mirrored are found at http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> - <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,<|>,{|},[|]</string> - <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,>|<,}|{,]|[</string> <!-- U+2264: "≤" LESS-THAN OR EQUAL TO U+2265: "≥" GREATER-THAN EQUAL TO U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK --> - <string name="more_keys_for_less_than">!fixedColumnOrder!3,‹|›,≤|≥,«|»</string> - <string name="more_keys_for_greater_than">!fixedColumnOrder!3,›|‹,≥|≤,»|«</string> - <!-- The following characters don't need BIDI mirroring. - U+2018: "‘" LEFT SINGLE QUOTATION MARK - U+2019: "’" RIGHT SINGLE QUOTATION MARK - U+201A: "‚" SINGLE LOW-9 QUOTATION MARK - U+201C: "“" LEFT DOUBLE QUOTATION MARK - U+201D: "”" RIGHT DOUBLE QUOTATION MARK - U+201E: "„" DOUBLE LOW-9 QUOTATION MARK --> - <string name="single_quotes">‘,’,‚</string> - <string name="double_quotes">“,”,„</string> - <string name="single_angle_quotes">!text/single_laqm_raqm_rtl</string> - <string name="double_angle_quotes">!text/double_laqm_raqm_rtl</string> + <string name="keyspec_left_parenthesis">(|)</string> + <string name="keyspec_right_parenthesis">)|(</string> + <string name="keyspec_left_square_bracket">[|]</string> + <string name="keyspec_right_square_bracket">]|[</string> + <string name="keyspec_left_curly_bracket">{|}</string> + <string name="keyspec_right_curly_bracket">}|{</string> + <string name="keyspec_less_than"><|></string> + <string name="keyspec_greater_than">>|<</string> + <string name="keyspec_less_than_equal">≤|≥</string> + <string name="keyspec_greater_than_equal">≥|≤</string> + <string name="keyspec_left_double_angle_quote">«|»</string> + <string name="keyspec_right_double_angle_quote">»|«</string> + <string name="keyspec_left_single_angle_quote">‹|›</string> + <string name="keyspec_right_single_angle_quote">›|‹</string> + <string name="single_quotes">!text/single_rqm_9qm</string> + <string name="double_quotes">!text/double_rqm_9qm</string> <!-- U+20AA: "₪" NEW SHEQEL SIGN --> <string name="keylabel_for_currency">₪</string> - <string name="keyhintlabel_for_tablet_comma">!</string> - <string name="more_keys_for_tablet_comma">!</string> - <string name="keyhintlabel_for_period">\?</string> - <string name="more_keys_for_period">\?</string> </resources> diff --git a/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ka-rGE/donottranslate-more-keys.xml index 8c2add44c..8c2add44c 100644 --- a/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ka-rGE/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-km/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-km-rKH/donottranslate-more-keys.xml index c33831c56..c33831c56 100644 --- a/tools/make-keyboard-text/res/values-km/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-km-rKH/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-lo/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-lo-rLA/donottranslate-more-keys.xml index 1d8ffa8cf..1d8ffa8cf 100644 --- a/tools/make-keyboard-text/res/values-lo/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-lo-rLA/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mn-rMN/donottranslate-more-keys.xml index a7f366685..a7f366685 100644 --- a/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-mn-rMN/donottranslate-more-keys.xml diff --git a/tools/make-keyboard-text/res/values-ne/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/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml @@ -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> 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 3c59b4bd1..9cdcb4668 100644 --- a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml +++ b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml @@ -63,6 +63,12 @@ <string name="keylabel_for_south_slavic_row3_8"></string> <string name="more_keys_for_cyrillic_ie"></string> <string name="more_keys_for_cyrillic_i"></string> + <string name="keylabel_for_swiss_row1_11"></string> + <string name="keylabel_for_swiss_row2_10"></string> + <string name="keylabel_for_swiss_row2_11"></string> + <string name="more_keys_for_swiss_row1_11"></string> + <string name="more_keys_for_swiss_row2_10"></string> + <string name="more_keys_for_swiss_row2_11"></string> <!-- Label for "switch to alphabetic" key. --> <string name="label_to_alpha_key">ABC</string> <string name="single_quotes">!text/single_lqm_rqm</string> @@ -77,7 +83,10 @@ <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,;,/,(,),#,!,\\,,\?,&,\\%,+,\",-,:,',\@"</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 U+2021: "‡" DOUBLE DAGGER U+2605: "★" BLACK STAR --> @@ -90,20 +99,11 @@ <string name="more_keys_for_bullet">♪,♥,♠,♦,♣</string> <!-- U+00B1: "±" PLUS-MINUS SIGN --> <string name="more_keys_for_plus">±</string> - <!-- The all letters need to be mirrored are found at - http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt --> - <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,<,{,[</string> - <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,>,},]</string> - <!-- U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK - U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - U+2264: "≤" LESS-THAN OR EQUAL TO - U+2265: "≥" GREATER-THAN EQUAL TO - U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK --> - <string name="more_keys_for_less_than">!fixedColumnOrder!3,‹,≤,«</string> - <string name="more_keys_for_greater_than">!fixedColumnOrder!3,›,≥,»</string> + <string name="more_keys_for_left_parenthesis">!fixedColumnOrder!3,!text/keyspecs_for_left_parenthesis_more_keys</string> + <string name="more_keys_for_right_parenthesis">!fixedColumnOrder!3,!text/keyspecs_for_right_parenthesis_more_keys</string> + <string name="more_keys_for_less_than">!fixedColumnOrder!3,!text/keyspec_left_single_angle_quote,!text/keyspec_less_than_equal,!text/keyspec_left_double_angle_quote</string> + <string name="more_keys_for_greater_than">!fixedColumnOrder!3,!text/keyspec_right_single_angle_quote,!text/keyspec_greater_than_equal,!text/keyspec_right_double_angle_quote</string> <string name="more_keys_for_arabic_diacritics"></string> - <string name="keyhintlabel_for_arabic_diacritics"></string> <string name="keylabel_for_symbols_1">1</string> <string name="keylabel_for_symbols_2">2</string> <string name="keylabel_for_symbols_3">3</string> @@ -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> @@ -154,45 +154,66 @@ <!-- U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N U+2205: "∅" EMPTY SET --> <string name="more_keys_for_symbols_0">ⁿ,∅</string> + <!-- The all letters need to be mirrored are found at + http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt + U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK + U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + U+2264: "≤" LESS-THAN OR EQUAL TO + U+2265: "≥" GREATER-THAN EQUAL TO + U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK --> + <string name="keyspec_left_parenthesis">(</string> + <string name="keyspec_right_parenthesis">)</string> + <string name="keyspec_left_square_bracket">[</string> + <string name="keyspec_right_square_bracket">]</string> + <string name="keyspec_left_curly_bracket">{</string> + <string name="keyspec_right_curly_bracket">}</string> + <string name="keyspec_less_than"><</string> + <string name="keyspec_greater_than">></string> + <string name="keyspec_less_than_equal">≤</string> + <string name="keyspec_greater_than_equal">≥</string> + <string name="keyspec_left_double_angle_quote">«</string> + <string name="keyspec_right_double_angle_quote">»</string> + <string name="keyspec_left_single_angle_quote">‹</string> + <string name="keyspec_right_single_angle_quote">›</string> + <!-- Comma key --> <string name="keylabel_for_comma">,</string> <string name="more_keys_for_comma"></string> - <string name="keylabel_for_symbols_question">\?</string> + <string name="keylabel_for_tablet_comma">,</string> + <string name="keyhintlabel_for_tablet_comma"></string> + <string name="more_keys_for_tablet_comma"></string> + <!-- Period key --> + <string name="keylabel_for_period">.</string> + <string name="keyhintlabel_for_period"></string> + <string name="more_keys_for_period">!text/more_keys_for_punctuation</string> + <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_semicolon">;</string> <string name="keylabel_for_symbols_percent">%</string> <!-- U+00A1: "¡" INVERTED EXCLAMATION MARK --> - <string name="more_keys_for_symbols_exclamation">¡</string> + <string name="more_keys_for_exclamation">¡</string> <!-- U+00BF: "¿" INVERTED QUESTION MARK --> - <string name="more_keys_for_symbols_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> - <string name="keylabel_for_tablet_comma">,</string> - <string name="keyhintlabel_for_tablet_comma"></string> - <string name="more_keys_for_tablet_comma"></string> - <string name="keyhintlabel_for_period"></string> - <!-- U+2026: "…" HORIZONTAL ELLIPSIS --> - <string name="more_keys_for_period">…</string> - <string name="keylabel_for_apostrophe">\'</string> - <string name="keyhintlabel_for_apostrophe">\"</string> - <string name="more_keys_for_apostrophe">\"</string> <string name="more_keys_for_q"></string> <string name="more_keys_for_x"></string> <string name="keylabel_for_q">q</string> <string name="keylabel_for_w">w</string> <string name="keylabel_for_y">y</string> <string name="keylabel_for_x">x</string> - <string name="keylabel_for_spanish_row2_10"></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> - <!-- Label for "switch to more symbol" modifier key. Must be short to fit on key! --> - <string name="label_to_more_symbol_key">= \\ <</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! --> <string name="label_to_more_symbol_for_tablet_key">~ [ <</string> - <!-- Label for "Tab" key. Must be short to fit on key! --> - <string name="label_tab_key">Tab</string> <!-- Label for "switch to phone numeric" key. Must be short to fit on key! --> <string name="label_to_phone_numeric_key">123</string> <!-- Label for "switch to phone symbols" key. Must be short to fit on key! --> @@ -206,12 +227,9 @@ <string name="keylabel_for_popular_domain">".com"</string> <!-- popular web domains for the locale - most popular, displayed on the keyboard --> <string name="more_keys_for_popular_domain">"!hasLabels!,.net,.org,.gov,.edu"</string> - <string name="more_keys_for_smiley">"!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ "</string> - <!-- U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK - U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - The following characters don't need BIDI mirroring. + <string name="keyspecs_for_left_parenthesis_more_keys">!text/keyspec_less_than,!text/keyspec_left_curly_bracket,!text/keyspec_left_square_bracket</string> + <string name="keyspecs_for_right_parenthesis_more_keys">!text/keyspec_greater_than,!text/keyspec_right_curly_bracket,!text/keyspec_right_square_bracket</string> + <!-- The following characters don't need BIDI mirroring. U+2018: "‘" LEFT SINGLE QUOTATION MARK U+2019: "’" RIGHT SINGLE QUOTATION MARK U+201A: "‚" SINGLE LOW-9 QUOTATION MARK @@ -221,28 +239,27 @@ <!-- Abbreviations are: laqm: LEFT-POINTING ANGLE QUOTATION MARK raqm: RIGHT-POINTING ANGLE QUOTATION MARK - rtl: Right-To-Left script order lqm: LEFT QUOTATION MARK rqm: RIGHT QUOTATION MARK 9qm: LOW-9 QUOTATION MARK --> <!-- The following each quotation mark pair consist of <opening quotation mark>, <closing quotation mark> and is named after (single|double)_<opening quotation mark>_<closing quotation mark>. --> - <string name="single_laqm_raqm">‹,›</string> - <string name="single_laqm_raqm_rtl">‹|›,›|‹</string> - <string name="single_raqm_laqm">›,‹</string> - <string name="double_laqm_raqm">«,»</string> - <string name="double_laqm_raqm_rtl">«|»,»|«</string> - <string name="double_raqm_laqm">»,«</string> + <string name="single_laqm_raqm">!text/keyspec_left_single_angle_quote,!text/keyspec_right_single_angle_quote</string> + <string name="single_raqm_laqm">!text/keyspec_right_single_angle_quote,!text/keyspec_left_single_angle_quote</string> + <string name="double_laqm_raqm">!text/keyspec_left_double_angle_quote,!text/keyspec_right_double_angle_quote</string> + <string name="double_raqm_laqm">!text/keyspec_right_double_angle_quote,!text/keyspec_left_double_angle_quote</string> <!-- The following each quotation mark triplet consists of <another quotation mark>, <opening quotation mark>, <closing quotation mark> and is named after (single|double)_<opening quotation mark>_<closing quotation mark>. --> <string name="single_lqm_rqm">‚,‘,’</string> <string name="single_9qm_lqm">’,‚,‘</string> <string name="single_9qm_rqm">‘,‚,’</string> + <string name="single_rqm_9qm">‘,’,‚</string> <string name="double_lqm_rqm">„,“,”</string> <string name="double_9qm_lqm">”,„,“</string> <string name="double_9qm_rqm">“,„,”</string> + <string name="double_rqm_9qm">“,”,„</string> <string name="more_keys_for_single_quote">!fixedColumnOrder!5,!text/single_quotes,!text/single_angle_quotes</string> <string name="more_keys_for_double_quote">!fixedColumnOrder!5,!text/double_quotes,!text/double_angle_quotes</string> <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,!text/double_quotes,!text/single_quotes,!text/double_angle_quotes,!text/single_angle_quotes</string> diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java index 331003e67..48bf8010a 100644 --- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java @@ -22,17 +22,26 @@ public class ArrayInitializerFormatter { private final PrintStream mOut; private final int mMaxWidth; private final String mIndent; + // String resource names array; indexed by {@link #CurrentIndex} and + // {@link #mStartIndexOfBuffer}. + private final String[] mResourceNames; private int mCurrentIndex = 0; - private String mFixedElement; + private String mLastElement; private final StringBuilder mBuffer = new StringBuilder(); private int mBufferedLen; - private int mBufferedIndex = Integer.MIN_VALUE; + private int mStartIndexOfBuffer = Integer.MIN_VALUE; - public ArrayInitializerFormatter(PrintStream out, int width, String indent) { + public ArrayInitializerFormatter(final PrintStream out, final int width, final String indent, + final String[] resourceNames) { mOut = out; mMaxWidth = width - indent.length(); mIndent = indent; + mResourceNames = resourceNames; + } + + public int getCurrentIndex() { + return mCurrentIndex; } public void flush() { @@ -40,42 +49,48 @@ public class ArrayInitializerFormatter { return; } final int lastIndex = mCurrentIndex - 1; - if (mBufferedIndex == lastIndex) { - mOut.format("%s/* %d */ %s\n", mIndent, mBufferedIndex, mBuffer); - } else if (mBufferedIndex == lastIndex - 1) { - final String[] elements = mBuffer.toString().split(" "); - mOut.format("%s/* %d */ %s\n" - + "%s/* %d */ %s\n", - mIndent, mBufferedIndex, elements[0], - mIndent, lastIndex, elements[1]); + if (mStartIndexOfBuffer == lastIndex) { + mOut.format("%s/* %s */ %s\n", + mIndent, mResourceNames[mStartIndexOfBuffer], mBuffer); + } else if (mStartIndexOfBuffer == lastIndex - 1) { + final String startElement = mBuffer.toString() + .substring(0, mBuffer.length() - mLastElement.length()) + .trim(); + mOut.format("%s/* %s */ %s\n" + + "%s/* %s */ %s\n", + mIndent, mResourceNames[mStartIndexOfBuffer], startElement, + mIndent, mResourceNames[lastIndex], mLastElement); } else { - mOut.format("%s/* %d~ */\n" + mOut.format("%s/* %s ~ */\n" + "%s%s\n" - + "%s/* ~%d */\n", mIndent, mBufferedIndex, + + "%s/* ~ %s */\n", + mIndent, mResourceNames[mStartIndexOfBuffer], mIndent, mBuffer, - mIndent, lastIndex); + mIndent, mResourceNames[lastIndex]); } mBuffer.setLength(0); mBufferedLen = 0; } - public void outCommentLines(String lines) { + public void outCommentLines(final String lines) { flush(); mOut.print(lines); - mFixedElement = null; + mLastElement = null; } - public void outElement(String element) { - if (!element.equals(mFixedElement)) { + public void outElement(final String element) { + if (!element.equals(mLastElement)) { flush(); - mBufferedIndex = mCurrentIndex; + mStartIndexOfBuffer = mCurrentIndex; } final int nextLen = mBufferedLen + " ".length() + element.length(); if (mBufferedLen != 0 && nextLen < mMaxWidth) { + // Element can fit in the current line. mBuffer.append(' '); mBuffer.append(element); mBufferedLen = nextLen; } else { + // Element should be on the next line. if (mBufferedLen != 0) { mBuffer.append('\n'); mBuffer.append(mIndent); @@ -84,6 +99,6 @@ public class ArrayInitializerFormatter { mBufferedLen = element.length(); } mCurrentIndex++; - mFixedElement = element; + mLastElement = element; } } diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java new file mode 100644 index 000000000..9fdc1f607 --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.keyboard.tools; + +import java.util.HashMap; +import java.util.Locale; + +/** + * A class to help with handling Locales in string form. + * + * This is a subset of com/android/inputmethod/latin/utils/LocaleUtils.java in order to use + * for the make-keyboard-text tool. + */ +public final class LocaleUtils { + private LocaleUtils() { + // Intentional empty constructor for utility class. + } + + private static final HashMap<String, Locale> sLocaleCache = new HashMap<String, Locale>(); + + /** + * Creates a locale from a string specification. + */ + public static Locale constructLocaleFromString(final String localeStr) { + if (localeStr == null) { + return null; + } + synchronized (sLocaleCache) { + Locale retval = sLocaleCache.get(localeStr); + if (retval != null) { + return retval; + } + String[] localeParams = localeStr.split("_", 3); + if (localeParams.length == 1) { + retval = new Locale(localeParams[0]); + } else if (localeParams.length == 2) { + retval = new Locale(localeParams[0], localeParams[1]); + } else if (localeParams.length == 3) { + retval = new Locale(localeParams[0], localeParams[1], localeParams[2]); + } + if (retval != null) { + sLocaleCache.put(localeStr, retval); + } + return retval; + } + } +} 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 2643e01ec..9bb2b38dd 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 @@ -25,6 +25,7 @@ import java.io.LineNumberReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.Locale; import java.util.jar.JarFile; @@ -32,13 +33,12 @@ import java.util.jar.JarFile; public class MoreKeysResources { private static final String TEXT_RESOURCE_NAME = "donottranslate-more-keys.xml"; - private static final String JAVA_TEMPLATE = "KeyboardTextsSet.tmpl"; + private static final String JAVA_TEMPLATE = "KeyboardTextsTable.tmpl"; private static final String MARK_NAMES = "@NAMES@"; private static final String MARK_DEFAULT_TEXTS = "@DEFAULT_TEXTS@"; private static final String MARK_TEXTS = "@TEXTS@"; private static final String MARK_LANGUAGES_AND_TEXTS = "@LANGUAGES_AND_TEXTS@"; - private static final String DEFAUT_LANGUAGE_NAME = "DEFAULT"; - private static final String ARRAY_NAME_FOR_LANGUAGE = "LANGUAGE_%s"; + private static final String DEFAULT_LANGUAGE_NAME = "DEFAULT"; private static final String EMPTY_STRING_VAR = "EMPTY"; private static final String NO_LANGUAGE_CODE = "zz"; @@ -48,8 +48,19 @@ public class MoreKeysResources { // Language to string resources map. private final HashMap<String, StringResourceMap> mResourcesMap = new HashMap<String, StringResourceMap>(); - // Name to id map. - private final HashMap<String, Integer> mNameToIdMap = new HashMap<String,Integer>(); + // Sorted languages list. The language is taken from string resource directories + // (values-<language>/) or {@link #DEFAULT_LANGUAGE_NAME} for the default string resource + // directory (values/). + private final ArrayList<String> mSortedLanguagesList = new ArrayList<String>(); + // Default string resources map. + private final StringResourceMap mDefaultResourceMap; + // Histogram of string resource names. This is used to sort {@link #mSortedResourceNames}. + private final HashMap<String, Integer> mNameHistogram = new HashMap<String, Integer>(); + // Sorted string resource names array; Descending order of histogram count. + // The string resource name is specified as an attribute "name" in string resource files. + // The string resource can be accessed by specifying name "!text/<name>" + // via {@link KeyboardTextsSet#getText(String)}. + private final String[] mSortedResourceNames; public MoreKeysResources(final JarFile jar) { mJar = jar; @@ -66,13 +77,52 @@ public class MoreKeysResources { close(stream); } } + mDefaultResourceMap = mResourcesMap.get(DEFAULT_LANGUAGE_NAME); + mSortedLanguagesList.addAll(mResourcesMap.keySet()); + Collections.sort(mSortedLanguagesList); + + // Initialize name histogram and names list. + final HashMap<String, Integer> nameHistogram = mNameHistogram; + final ArrayList<String> resourceNamesList = new ArrayList<String>(); + for (final StringResource res : mDefaultResourceMap.getResources()) { + nameHistogram.put(res.mName, 0); // Initialize histogram value. + resourceNamesList.add(res.mName); + } + // Make name histogram. + for (final String language : mResourcesMap.keySet()) { + final StringResourceMap resMap = mResourcesMap.get(language); + if (resMap == mDefaultResourceMap) continue; + for (final StringResource res : resMap.getResources()) { + if (!mDefaultResourceMap.contains(res.mName)) { + throw new RuntimeException(res.mName + " in " + language + + " doesn't have default resource"); + } + final int histogramValue = nameHistogram.get(res.mName); + nameHistogram.put(res.mName, histogramValue + 1); + } + } + // Sort names list. + Collections.sort(resourceNamesList, new Comparator<String>() { + @Override + public int compare(final String leftName, final String rightName) { + final int leftCount = nameHistogram.get(leftName); + final int rightCount = nameHistogram.get(rightName); + // Descending order of histogram count. + if (leftCount > rightCount) return -1; + if (leftCount < rightCount) return 1; + // TODO: Add further criteria to order the same histogram value names to be able to + // minimize footprints of string resources arrays. + return 0; + } + }); + mSortedResourceNames = resourceNamesList.toArray(new String[resourceNamesList.size()]); } private static String getLanguageFromResDir(final String dirName) { final int languagePos = dirName.indexOf('-'); if (languagePos < 0) { // Default resource. - return DEFAUT_LANGUAGE_NAME; + return DEFAULT_LANGUAGE_NAME; } final String language = dirName.substring(languagePos + 1); final int countryPos = language.indexOf("-r"); @@ -84,10 +134,12 @@ public class MoreKeysResources { public void writeToJava(final String outDir) { final ArrayList<String> list = JarUtils.getNameListing(mJar, JAVA_TEMPLATE); - if (list.isEmpty()) + if (list.isEmpty()) { throw new RuntimeException("Can't find java template " + JAVA_TEMPLATE); - if (list.size() > 1) + } + if (list.size() > 1) { throw new RuntimeException("Found multiple java template " + JAVA_TEMPLATE); + } final String template = list.get(0); final String javaPackage = template.substring(0, template.lastIndexOf('/')); PrintStream ps = null; @@ -131,70 +183,69 @@ public class MoreKeysResources { } private void dumpNames(final PrintStream out) { - final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); - int id = 0; - for (final StringResource res : defaultResMap.getResources()) { - out.format(" /* %2d */ \"%s\",\n", id, res.mName); - mNameToIdMap.put(res.mName, id); - id++; + final int namesCount = mSortedResourceNames.length; + for (int index = 0; index < namesCount; index++) { + final String name = mSortedResourceNames[index]; + final int histogramValue = mNameHistogram.get(name); + out.format(" /* %3d:%2d */ \"%s\",\n", index, histogramValue, name); } } private void dumpDefaultTexts(final PrintStream out) { - final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); - dumpTextsInternal(out, defaultResMap, defaultResMap); + final int outputArraySize = dumpTextsInternal(out, mDefaultResourceMap); + mDefaultResourceMap.setOutputArraySize(outputArraySize); + } + + private static String getArrayNameForLanguage(final String language) { + return "LANGUAGE_" + language; } private void dumpTexts(final PrintStream out) { - final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); - final ArrayList<String> allLanguages = new ArrayList<String>(); - allLanguages.addAll(mResourcesMap.keySet()); - Collections.sort(allLanguages); - for (final String language : allLanguages) { - if (language.equals(DEFAUT_LANGUAGE_NAME)) { - continue; - } - out.format(" /* Language %s: %s */\n", language, getLanguageDisplayName(language)); - out.format(" private static final String[] " + ARRAY_NAME_FOR_LANGUAGE + " = {\n", - language); + for (final String language : mSortedLanguagesList) { final StringResourceMap resMap = mResourcesMap.get(language); - for (final StringResource res : resMap.getResources()) { - if (!defaultResMap.contains(res.mName)) { - throw new RuntimeException(res.mName + " in " + language - + " doesn't have default resource"); - } - } - dumpTextsInternal(out, resMap, defaultResMap); + if (resMap == mDefaultResourceMap) continue; + out.format(" /* Language %s: %s */\n", language, getLanguageDisplayName(language)); + out.format(" private static final String[] " + getArrayNameForLanguage(language) + + " = {\n"); + final int outputArraySize = dumpTextsInternal(out, resMap); + resMap.setOutputArraySize(outputArraySize); out.format(" };\n\n"); } } private void dumpLanguageMap(final PrintStream out) { - final ArrayList<String> allLanguages = new ArrayList<String>(); - allLanguages.addAll(mResourcesMap.keySet()); - Collections.sort(allLanguages); - for (final String language : allLanguages) { - out.format(" \"%s\", " + ARRAY_NAME_FOR_LANGUAGE + ", /* %s */\n", - language, language, getLanguageDisplayName(language)); + for (final String language : mSortedLanguagesList) { + final StringResourceMap resMap = mResourcesMap.get(language); + final Locale locale = LocaleUtils.constructLocaleFromString(language); + final String languageKeyToDump = locale.getCountry().isEmpty() + ? String.format("\"%s\"", language) + : String.format("\"%s\"", locale.getLanguage()); + out.format(" %s, %-15s /* %3d/%3d %s */\n", + languageKeyToDump, getArrayNameForLanguage(language) + ",", + resMap.getResources().size(), resMap.getOutputArraySize(), + getLanguageDisplayName(language)); } } private static String getLanguageDisplayName(final String language) { - if (language.equals(NO_LANGUAGE_CODE)) { + final Locale locale = LocaleUtils.constructLocaleFromString(language); + if (locale.getLanguage().equals(NO_LANGUAGE_CODE)) { return NO_LANGUAGE_DISPLAY_NAME; - } else { - return new Locale(language).getDisplayLanguage(); } + return locale.getDisplayName(Locale.ENGLISH); } - private static void dumpTextsInternal(final PrintStream out, final StringResourceMap resMap, - final StringResourceMap defaultResMap) { + private int dumpTextsInternal(final PrintStream out, final StringResourceMap resMap) { final ArrayInitializerFormatter formatter = - new ArrayInitializerFormatter(out, 100, " "); + new ArrayInitializerFormatter(out, 100, " ", mSortedResourceNames); + int outputArraySize = 0; boolean successiveNull = false; - for (final StringResource defaultRes : defaultResMap.getResources()) { - if (resMap.contains(defaultRes.mName)) { - final StringResource res = resMap.get(defaultRes.mName); + final int namesCount = mSortedResourceNames.length; + for (int index = 0; index < namesCount; index++) { + final String name = mSortedResourceNames[index]; + final StringResource res = resMap.get(name); + if (res != null) { + // TODO: Check whether the resource value is equal to the default. if (res.mComment != null) { formatter.outCommentLines(addPrefix(" // ", res. mComment)); } @@ -205,6 +256,7 @@ public class MoreKeysResources { formatter.outElement(String.format("\"%s\",", escaped)); } successiveNull = false; + outputArraySize = formatter.getCurrentIndex(); } else { formatter.outElement("null,"); successiveNull = true; @@ -213,6 +265,7 @@ public class MoreKeysResources { if (!successiveNull) { formatter.flush(); } + return outputArraySize; } private static String addPrefix(final String prefix, final String lines) { @@ -234,26 +287,10 @@ 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(Closeable stream) { + private static void close(final Closeable stream) { try { if (stream != null) { stream.close(); diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java index cc7ff6a9c..4eff8a24b 100644 --- a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java @@ -39,6 +39,12 @@ public class StringResourceMap { // Name to string resource map. private final Map<String, StringResource> mResourcesMap; + // The length of String[] that is created from this {@link StringResourceMap}. The length is + // calculated in {@link MoreKeysResources#dumpTexts(OutputStream)} and recorded by + // {@link #setOutputArraySize(int)}. The recorded length is used as a part of comment by + // {@link MoreKeysResources#dumpLanguageMap(OutputStream)} via {@link #getOutputArraySize()}. + private int mOutputArraySize; + public StringResourceMap(final InputStream is) { final StringResourceHandler handler = new StringResourceHandler(); final SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -77,6 +83,14 @@ public class StringResourceMap { return mResourcesMap.get(name); } + public void setOutputArraySize(final int arraySize) { + mOutputArraySize = arraySize; + } + + public int getOutputArraySize() { + return mOutputArraySize; + } + static class StringResourceHandler extends DefaultHandler2 { private static final String TAG_RESOURCES = "resources"; private static final String TAG_STRING = "string"; |