diff options
Diffstat (limited to 'tools')
6 files changed, 146 insertions, 10 deletions
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java index 7b311c3ec..cacee5268 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Dicttool.java @@ -72,15 +72,21 @@ public class Dicttool { return command; } - private void execute(final String[] arguments) { + /** + * Executes the specified command with the specified arguments. + * @param arguments the arguments passed to dicttool. + * @return 0 for success, an error code otherwise (always 1 at the moment) + */ + private int execute(final String[] arguments) { final Command command = getCommand(arguments); try { command.run(); + return 0; } catch (Exception e) { System.out.println("Exception while processing command " + command.getClass().getSimpleName() + " : " + e); e.printStackTrace(); - return; + return 1; } } @@ -89,6 +95,7 @@ public class Dicttool { help(); return; } - new Dicttool().execute(arguments); + // Exit with the success/error code from #execute() as status. + System.exit(new Dicttool().execute(arguments)); } } diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java index df5ea35bb..972b6e7e6 100644 --- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java +++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java @@ -16,10 +16,12 @@ package com.android.inputmethod.latin.dicttool; +import com.android.inputmethod.latin.makedict.BinaryDictIOTests; import com.android.inputmethod.latin.makedict.BinaryDictIOUtilsTests; import com.android.inputmethod.latin.makedict.BinaryDictInputOutputTest; import com.android.inputmethod.latin.makedict.FusionDictionaryTest; +import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -36,7 +38,8 @@ public class Test extends Dicttool.Command { BinaryDictOffdeviceUtilsTests.class, FusionDictionaryTest.class, BinaryDictInputOutputTest.class, - BinaryDictIOUtilsTests.class + BinaryDictIOUtilsTests.class, + BinaryDictIOTests.class }; private ArrayList<Method> mAllTestMethods = new ArrayList<Method>(); private ArrayList<String> mUsedTestMethods = new ArrayList<String>(); @@ -86,12 +89,19 @@ public class Test extends Dicttool.Command { for (final Method m : mAllTestMethods) { final Class<?> declaringClass = m.getDeclaringClass(); if (!mUsedTestMethods.isEmpty() && !mUsedTestMethods.contains(m.getName())) continue; - final Object instance; - if (BinaryDictIOUtilsTests.class == declaringClass) { - instance = new BinaryDictIOUtilsTests(mSeed, mMaxUnigrams); - } else { - instance = declaringClass.newInstance(); + // Some of the test classes expose a two-argument constructor, taking a long as a + // seed for Random, and an int for a vocabulary size to test the dictionary with. They + // correspond respectively to the -s and -m numerical arguments to this command, which + // are stored in mSeed and mMaxUnigrams. If the two-arguments constructor is present, + // then invoke it; otherwise, invoke the default constructor. + Constructor<?> twoArgsConstructor = null; + try { + twoArgsConstructor = declaringClass.getDeclaredConstructor(Long.TYPE, Integer.TYPE); + } catch (NoSuchMethodException e) { + // No constructor with two args } + final Object instance = null == twoArgsConstructor ? declaringClass.newInstance() + : twoArgsConstructor.newInstance(mSeed, mMaxUnigrams); m.invoke(instance); } } diff --git a/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl b/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl index 2fc97b5c6..479a766fb 100644 --- a/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl +++ b/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl @@ -20,7 +20,7 @@ import android.content.Context; import android.content.res.Resources; import com.android.inputmethod.annotations.UsedForTesting; -import com.android.inputmethod.latin.CollectionUtils; +import com.android.inputmethod.latin.utils.CollectionUtils; import java.util.HashMap; diff --git a/tools/maketext/res/values-az/donottranslate-more-keys.xml b/tools/maketext/res/values-az/donottranslate-more-keys.xml new file mode 100644 index 000000000..db1784c17 --- /dev/null +++ b/tools/maketext/res/values-az/donottranslate-more-keys.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX --> + <string name="more_keys_for_a">â</string> + <!-- U+0259: "ə" LATIN SMALL LETTER SCHWA --> + <string name="more_keys_for_e">ə</string> + <!-- U+0131: "ı" LATIN SMALL LETTER DOTLESS I + U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX + U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS + U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE + U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE + U+012F: "į" LATIN SMALL LETTER I WITH OGONEK + U+012B: "ī" LATIN SMALL LETTER I WITH MACRON --> + <string name="more_keys_for_i">ı,î,ï,ì,í,į,ī</string> + <!-- U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS + U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX + U+0153: "œ" LATIN SMALL LIGATURE OE + U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE + U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE + U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE + U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE + U+014D: "ō" LATIN SMALL LETTER O WITH MACRON --> + <string name="more_keys_for_o">ö,ô,œ,ò,ó,õ,ø,ō</string> + <!-- U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS + U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX + U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE + U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE + U+016B: "ū" LATIN SMALL LETTER U WITH MACRON --> + <string name="more_keys_for_u">ü,û,ù,ú,ū</string> + <!-- U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA + U+00DF: "ß" LATIN SMALL LETTER SHARP S + U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE + U+0161: "š" LATIN SMALL LETTER S WITH CARON --> + <string name="more_keys_for_s">ş,ß,ś,š</string> + <!-- U+011F: "ğ" LATIN SMALL LETTER G WITH BREVE --> + <string name="more_keys_for_g">ğ</string> + <!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA + U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE + U+010D: "č" LATIN SMALL LETTER C WITH CARON --> + <string name="more_keys_for_c">ç,ć,č</string> +</resources> diff --git a/tools/maketext/res/values-kk/donottranslate-more-keys.xml b/tools/maketext/res/values-kk/donottranslate-more-keys.xml new file mode 100644 index 000000000..0e953ff21 --- /dev/null +++ b/tools/maketext/res/values-kk/donottranslate-more-keys.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 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. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- U+0449: "щ" CYRILLIC SMALL LETTER SHCHA --> + <string name="keylabel_for_east_slavic_row1_9">щ</string> + <!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN --> + <string name="keylabel_for_east_slavic_row1_12">ъ</string> + <!-- U+044B: "ы" CYRILLIC SMALL LETTER YERU --> + <string name="keylabel_for_east_slavic_row2_1">ы</string> + <!-- U+044D: "э" CYRILLIC SMALL LETTER E --> + <string name="keylabel_for_east_slavic_row2_11">э</string> + <!-- U+0438: "и" CYRILLIC SMALL LETTER I --> + <string name="keylabel_for_east_slavic_row3_5">и</string> + <!-- U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U + U+04B1: "ұ" CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE --> + <string name="more_keys_for_cyrillic_u">ү,ұ</string> + <!-- U+049B: "қ" CYRILLIC SMALL LETTER KA WITH DESCENDER --> + <string name="more_keys_for_cyrillic_ka">қ</string> + <!-- U+0451: "ё" CYRILLIC SMALL LETTER IO --> + <string name="more_keys_for_cyrillic_ie">ё</string> + <!-- U+04A3: "ң" CYRILLIC SMALL LETTER EN WITH DESCENDER --> + <string name="more_keys_for_cyrillic_en">ң</string> + <!-- U+0493: "ғ" CYRILLIC SMALL LETTER GHE WITH STROKE --> + <string name="more_keys_for_cyrillic_ghe">ғ</string> + <!-- U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I --> + <string name="more_keys_for_east_slavic_row2_1">і</string> + <!-- U+04D9: "ә" CYRILLIC SMALL LETTER SCHWA --> + <string name="more_keys_for_cyrillic_a">ә</string> + <!-- U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O --> + <string name="more_keys_for_cyrillic_o">ө</string> + <!-- U+04BB: "һ" CYRILLIC SMALL LETTER SHHA --> + <string name="more_keys_for_east_slavic_row2_11">һ</string> + <!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN --> + <string name="more_keys_for_cyrillic_soft_sign">ъ</string> + <!-- Label for "switch to alphabetic" key. + U+0410: "А" CYRILLIC CAPITAL LETTER A + U+0411: "Б" CYRILLIC CAPITAL LETTER BE + U+0412: "В" CYRILLIC CAPITAL LETTER VE --> + <string name="label_to_alpha_key">АБВ</string> +</resources> diff --git a/tools/maketext/res/values/donottranslate-more-keys.xml b/tools/maketext/res/values/donottranslate-more-keys.xml index c2b7513f3..b53a36917 100644 --- a/tools/maketext/res/values/donottranslate-more-keys.xml +++ b/tools/maketext/res/values/donottranslate-more-keys.xml @@ -49,11 +49,14 @@ <string name="keylabel_for_east_slavic_row2_11"></string> <string name="keylabel_for_east_slavic_row3_5"></string> <string name="more_keys_for_cyrillic_u"></string> + <string name="more_keys_for_cyrillic_ka"></string> <string name="more_keys_for_cyrillic_en"></string> <string name="more_keys_for_cyrillic_ghe"></string> <string name="more_keys_for_east_slavic_row2_1"></string> + <string name="more_keys_for_cyrillic_a"></string> <string name="more_keys_for_cyrillic_o"></string> <string name="more_keys_for_cyrillic_soft_sign"></string> + <string name="more_keys_for_east_slavic_row2_11"></string> <string name="keylabel_for_south_slavic_row1_6"></string> <string name="keylabel_for_south_slavic_row2_11"></string> <string name="keylabel_for_south_slavic_row3_1"></string> |