diff options
3 files changed, 98 insertions, 5 deletions
diff --git a/java/res/values-zh-rTW/strings.xml b/java/res/values-zh-rTW/strings.xml index 27749497c..4d39050f7 100644 --- a/java/res/values-zh-rTW/strings.xml +++ b/java/res/values-zh-rTW/strings.xml @@ -29,7 +29,7 @@ <string name="popup_on_keypress" msgid="123894815723512944">"按鍵時彈出"</string> <string name="general_category" msgid="1859088467017573195">"一般"</string> <string name="correction_category" msgid="2236750915056607613">"文字修正"</string> - <string name="gesture_typing_category" msgid="497263612130532630">"手勢輸入"</string> + <string name="gesture_typing_category" msgid="497263612130532630">"滑行輸入"</string> <string name="misc_category" msgid="6894192814868233453">"其他選項"</string> <string name="advanced_settings" msgid="362895144495591463">"進階設定"</string> <string name="advanced_settings_summary" msgid="4487980456152830271">"進階選項"</string> @@ -68,11 +68,11 @@ <string name="auto_correction_threshold_mode_very_aggressive" msgid="1853309024129480416">"極大幅度更正"</string> <string name="bigram_prediction" msgid="1084449187723948550">"建議下一個字詞"</string> <string name="bigram_prediction_summary" msgid="3896362682751109677">"根據前一個字詞提供建議"</string> - <string name="gesture_input" msgid="826951152254563827">"啟用手勢輸入"</string> + <string name="gesture_input" msgid="826951152254563827">"啟用滑行輸入"</string> <string name="gesture_input_summary" msgid="9180350639305731231">"以滑動方式寫出字詞中字母來輸入字詞"</string> <string name="gesture_preview_trail" msgid="3802333369335722221">"顯示手勢軌跡"</string> <string name="gesture_floating_preview_text" msgid="4443240334739381053">"動態浮動預覽"</string> - <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"使用手勢輸入時顯示建議字詞"</string> + <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"使用滑行輸入時顯示建議字詞"</string> <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>:已儲存"</string> <string name="label_go_key" msgid="1635148082137219148">"前往"</string> <string name="label_next_key" msgid="362972844525672568">"下一頁"</string> @@ -176,7 +176,7 @@ <string name="error" msgid="8940763624668513648">"發生錯誤"</string> <string name="button_default" msgid="3988017840431881491">"預設"</string> <string name="setup_welcome_title" msgid="6112821709832031715">"歡迎使用 <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> - <string name="setup_welcome_additional_description" msgid="8150252008545768953">"含手勢輸入功能"</string> + <string name="setup_welcome_additional_description" msgid="8150252008545768953">"含滑行輸入功能"</string> <string name="setup_start_action" msgid="8936036460897347708">"開始設定"</string> <string name="setup_next_action" msgid="371821437915144603">"下一步"</string> <string name="setup_steps_title" msgid="6400373034871816182">"正在設定「<xliff:g id="APPLICATION_NAME">%s</xliff:g>」"</string> diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java index b99aca2c8..5aee135ad 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java @@ -264,7 +264,7 @@ public final class FormatSpec { static final int PTNODE_SHORTCUT_LIST_SIZE_SIZE = 2; // These values are used only by version 4 or later. - static final String TRIE_FILE_EXTENSION = ".trie"; + public static final String TRIE_FILE_EXTENSION = ".trie"; static final String FREQ_FILE_EXTENSION = ".freq"; static final String UNIGRAM_TIMESTAMP_FILE_EXTENSION = ".timestamp"; // tat = Terminal Address Table diff --git a/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java new file mode 100644 index 000000000..25fb1c2a8 --- /dev/null +++ b/tests/src/com/android/inputmethod/latin/Ver4BinaryDictionaryTests.java @@ -0,0 +1,93 @@ +/* + * 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.latin; + +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.LargeTest; +import android.util.Log; + +import com.android.inputmethod.latin.makedict.DictEncoder; +import com.android.inputmethod.latin.makedict.FormatSpec; +import com.android.inputmethod.latin.makedict.FusionDictionary; +import com.android.inputmethod.latin.makedict.UnsupportedFormatException; +import com.android.inputmethod.latin.makedict.Ver4DictEncoder; +import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; +import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Locale; + +@LargeTest +public class Ver4BinaryDictionaryTests extends AndroidTestCase { + private static final String TAG = Ver4BinaryDictionaryTests.class.getSimpleName(); + private static final String TEST_LOCALE = "test"; + private static final FormatSpec.FormatOptions FORMAT_OPTIONS = + new FormatSpec.FormatOptions(4, true /* supportsDynamicUpdate */); + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + // TODO: remove after native code support dictionary creation. + private DictionaryOptions getDictionaryOptions(final String id, final String version) { + final DictionaryOptions options = new DictionaryOptions(new HashMap<String, String>(), + false /* germanUmlautProcessing */, false /* frenchLigatureProcessing */); + options.mAttributes.put("version", version); + options.mAttributes.put("dictionary", id); + return options; + } + + // TODO: remove after native code support dictionary creation. + private File getTrieFile(final String id, final String version) { + return new File(getContext().getCacheDir() + "/" + id + "." + version, + TEST_LOCALE + "." + version + FormatSpec.TRIE_FILE_EXTENSION); + } + + public void testIsValidDictionary() { + final String dictVersion = Long.toString(System.currentTimeMillis()); + final File trieFile = getTrieFile(TEST_LOCALE, dictVersion); + + BinaryDictionary binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, + Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); + assertFalse(binaryDictionary.isValidDictionary()); + + final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), + getDictionaryOptions(TEST_LOCALE, dictVersion)); + DictEncoder encoder = new Ver4DictEncoder(getContext().getCacheDir()); + try { + encoder.writeDictionary(dict, FORMAT_OPTIONS); + } catch (IOException e) { + Log.e(TAG, "IOException while writing dictionary", e); + } catch (UnsupportedFormatException e) { + Log.e(TAG, "Unsupported format", e); + } + + binaryDictionary = new BinaryDictionary(trieFile.getAbsolutePath(), + 0 /* offset */, trieFile.length(), true /* useFullEditDistance */, + Locale.getDefault(), TEST_LOCALE, true /* isUpdatable */); + assertTrue(binaryDictionary.isValidDictionary()); + } +} |