aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dicttool/Android.mk20
-rw-r--r--tools/dicttool/NativeLib.mk14
-rw-r--r--tools/dicttool/compat/android/content/SharedPreferences.java23
-rw-r--r--tools/dicttool/compat/android/graphics/Rect.java20
-rw-r--r--tools/dicttool/compat/android/text/TextUtils.java107
-rw-r--r--tools/dicttool/compat/android/util/Log.java14
-rw-r--r--tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java21
-rw-r--r--tools/dicttool/compat/android/view/inputmethod/EditorInfo.java20
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/keyboard/Key.java24
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/keyboard/Keyboard.java22
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/keyboard/ProximityInfo.java28
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/latin/LatinIME.java20
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java21
-rw-r--r--tools/dicttool/compat/com/android/inputmethod/latin/settings/SettingsValues.java23
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java15
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java11
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java12
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java5
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java13
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java22
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/makedict/BinaryDictEncoderFlattenTreeTests.java3
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java3
-rw-r--r--tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl6
-rw-r--r--tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml18
-rw-r--r--tools/make-keyboard-text/res/values-az-rAZ/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-be-rBY/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml2
-rw-r--r--tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml12
-rw-r--r--tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml11
-rw-r--r--tools/make-keyboard-text/res/values-et-rEE/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml17
-rw-r--r--tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml12
-rw-r--r--tools/make-keyboard-text/res/values-hy-rAM/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-hy/donottranslate-more-keys.xml)12
-rw-r--r--tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml5
-rw-r--r--tools/make-keyboard-text/res/values-ka-rGE/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-km-rKH/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-km/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-lo-rLA/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-lo/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-mn-rMN/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values-ne-rNP/donottranslate-more-keys.xml (renamed from tools/make-keyboard-text/res/values-ne/donottranslate-more-keys.xml)0
-rw-r--r--tools/make-keyboard-text/res/values/donottranslate-more-keys.xml35
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/LocaleUtils.java61
-rw-r--r--tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java33
42 files changed, 556 insertions, 129 deletions
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
index 3d09c0508..95afb4cc1 100644
--- a/tools/dicttool/Android.mk
+++ b/tools/dicttool/Android.mk
@@ -27,10 +27,28 @@ LATINIME_BASE_SOURCE_DIRECTORY := $(LATINIME_LOCAL_DIR)/java/src/com/android/inp
LATINIME_ANNOTATIONS_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/annotations
LATINIME_CORE_SOURCE_DIRECTORY := $(LATINIME_BASE_SOURCE_DIRECTORY)/latin
MAKEDICT_CORE_SOURCE_DIRECTORY := $(LATINIME_CORE_SOURCE_DIRECTORY)/makedict
+
+# Dependencies for Dicttool. Most of these files are needed by BinaryDictionary.java. Note that
+# a significant part of the dependencies are mocked in the compat/ directory, with empty or
+# nearly-empty implementations, for parts that we don't use in Dicttool.
USED_TARGETTED_UTILS := \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/BinaryDictionary.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/DicTraverseSession.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/Dictionary.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/InputPointers.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/LastComposedWord.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/LatinImeLogger.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/SuggestedWords.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/WordComposer.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/settings/NativeSuggestOptions.java \
$(LATINIME_CORE_SOURCE_DIRECTORY)/utils/ByteArrayDictBuffer.java \
$(LATINIME_CORE_SOURCE_DIRECTORY)/utils/CollectionUtils.java \
- $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/JniUtils.java
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/FileUtils.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/JniUtils.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/LocaleUtils.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/ResizableIntArray.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/StringUtils.java \
+ $(LATINIME_CORE_SOURCE_DIRECTORY)/utils/UnigramProperty.java
DICTTOOL_ONDEVICE_TESTS_DIRECTORY := \
$(LATINIME_LOCAL_DIR)/tests/src/com/android/inputmethod/latin/makedict/
diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk
index a3d3c0295..05e5841d3 100644
--- a/tools/dicttool/NativeLib.mk
+++ b/tools/dicttool/NativeLib.mk
@@ -20,12 +20,17 @@ include $(CLEAR_VARS)
LATINIME_DIR_RELATIVE_TO_DICTTOOL := ../..
+ifeq ($(FLAG_DBG), true)
+ $(warning Making debug version of native library)
+ LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
+endif #FLAG_DBG
+
ifneq ($(strip $(HOST_JDK_IS_64BIT_VERSION)),)
LOCAL_CFLAGS += -m64
LOCAL_LDFLAGS += -m64
endif #HOST_JDK_IS_64BIT_VERSION
-LOCAL_CFLAGS += -DHOST_TOOL -fPIC
+LOCAL_CFLAGS += -DHOST_TOOL -fPIC -Wno-deprecated
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LATINIME_NATIVE_JNI_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni
@@ -33,11 +38,7 @@ LATINIME_NATIVE_SRC_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni/src
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(LATINIME_NATIVE_SRC_DIR)
# Used in jni_common.cpp to avoid registering useless methods.
-LATIN_IME_JNI_SRC_FILES := \
- com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp \
- jni_common.cpp
-
-LATIN_IME_CORE_SRC_FILES :=
+include $(LOCAL_PATH)/$(LATINIME_NATIVE_JNI_DIR)/NativeFileList.mk
LOCAL_SRC_FILES := \
$(addprefix $(LATINIME_NATIVE_JNI_DIR)/, $(LATIN_IME_JNI_SRC_FILES)) \
@@ -48,4 +49,5 @@ LOCAL_MODULE := $(LATINIME_HOST_NATIVE_LIBNAME)
include $(BUILD_HOST_SHARED_LIBRARY)
# Clear our private variables
+include $(LOCAL_PATH)/$(LATINIME_NATIVE_JNI_DIR)/CleanupNativeFileList.mk
LATINIME_DIR_RELATIVE_TO_DICTTOOL := ../..
diff --git a/tools/dicttool/compat/android/content/SharedPreferences.java b/tools/dicttool/compat/android/content/SharedPreferences.java
new file mode 100644
index 000000000..cfeb1532d
--- /dev/null
+++ b/tools/dicttool/compat/android/content/SharedPreferences.java
@@ -0,0 +1,23 @@
+/*
+ * 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 android.content;
+
+public class SharedPreferences {
+ public interface OnSharedPreferenceChangeListener {
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key);
+ }
+}
diff --git a/tools/dicttool/compat/android/graphics/Rect.java b/tools/dicttool/compat/android/graphics/Rect.java
new file mode 100644
index 000000000..c7b61d759
--- /dev/null
+++ b/tools/dicttool/compat/android/graphics/Rect.java
@@ -0,0 +1,20 @@
+/*
+ * 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 android.graphics;
+
+public class Rect {
+}
diff --git a/tools/dicttool/compat/android/text/TextUtils.java b/tools/dicttool/compat/android/text/TextUtils.java
new file mode 100644
index 000000000..5a94b7d4c
--- /dev/null
+++ b/tools/dicttool/compat/android/text/TextUtils.java
@@ -0,0 +1,107 @@
+/*
+ * 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 android.text;
+
+public class TextUtils {
+ private TextUtils() { /* cannot be instantiated */ }
+
+ /**
+ * Returns true if the string is null or 0-length.
+ * @param str the string to be examined
+ * @return true if str is null or zero length
+ */
+ public static boolean isEmpty(CharSequence str) {
+ if (str == null || str.length() == 0)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Returns true if a and b are equal, including if they are both null.
+ * <p><i>Note: In platform versions 1.1 and earlier, this method only worked well if
+ * both the arguments were instances of String.</i></p>
+ * @param a first CharSequence to check
+ * @param b second CharSequence to check
+ * @return true if a and b are equal
+ */
+ public static boolean equals(CharSequence a, CharSequence b) {
+ if (a == b) return true;
+ int length;
+ if (a != null && b != null && (length = a.length()) == b.length()) {
+ if (a instanceof String && b instanceof String) {
+ return a.equals(b);
+ } else {
+ for (int i = 0; i < length; i++) {
+ if (a.charAt(i) != b.charAt(i)) return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns list of multiple {@link CharSequence} joined into a single
+ * {@link CharSequence} separated by localized delimiter such as ", ".
+ *
+ * @hide
+ */
+ public static CharSequence join(Iterable<CharSequence> list) {
+ final CharSequence delimiter = ", ";
+ return join(delimiter, list);
+ }
+
+ /**
+ * Returns a string containing the tokens joined by delimiters.
+ * @param tokens an array objects to be joined. Strings will be formed from
+ * the objects by calling object.toString().
+ */
+ public static String join(CharSequence delimiter, Object[] tokens) {
+ StringBuilder sb = new StringBuilder();
+ boolean firstTime = true;
+ for (Object token: tokens) {
+ if (firstTime) {
+ firstTime = false;
+ } else {
+ sb.append(delimiter);
+ }
+ sb.append(token);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns a string containing the tokens joined by delimiters.
+ * @param tokens an array objects to be joined. Strings will be formed from
+ * the objects by calling object.toString().
+ */
+ public static String join(CharSequence delimiter, Iterable tokens) {
+ StringBuilder sb = new StringBuilder();
+ boolean firstTime = true;
+ for (Object token: tokens) {
+ if (firstTime) {
+ firstTime = false;
+ } else {
+ sb.append(delimiter);
+ }
+ sb.append(token);
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/tools/dicttool/compat/android/util/Log.java b/tools/dicttool/compat/android/util/Log.java
index b3b6dd847..9410e74a2 100644
--- a/tools/dicttool/compat/android/util/Log.java
+++ b/tools/dicttool/compat/android/util/Log.java
@@ -25,13 +25,19 @@ public class Log {
public static void d(final String tag, final String message) {
System.out.println(tag + " : " + message);
}
- public static void d(final String tag, final String message, final Throwable e) {
- System.out.println(tag + " : " + message + " : " + e);
+ public static void d(final String tag, final String message, final Throwable t) {
+ System.out.println(tag + " : " + message + " : " + t);
}
public static void e(final String tag, final String message) {
d(tag, message);
}
- public static void e(final String tag, final String message, final Throwable e) {
- d(tag, message, e);
+ public static void e(final String tag, final String message, final Throwable t) {
+ d(tag, message, t);
+ }
+ public static void w(final String tag, final String message) {
+ d(tag, message);
+ }
+ public static void w(final String tag, final String message, final Throwable t) {
+ d(tag, message, t);
}
}
diff --git a/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java b/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java
new file mode 100644
index 000000000..fbce72556
--- /dev/null
+++ b/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java
@@ -0,0 +1,21 @@
+/*
+ * 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 android.view.inputmethod;
+
+public class CompletionInfo {
+ public final String getText() { return ""; }
+}
diff --git a/tools/dicttool/compat/android/view/inputmethod/EditorInfo.java b/tools/dicttool/compat/android/view/inputmethod/EditorInfo.java
new file mode 100644
index 000000000..9c7118118
--- /dev/null
+++ b/tools/dicttool/compat/android/view/inputmethod/EditorInfo.java
@@ -0,0 +1,20 @@
+/*
+ * 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 android.view.inputmethod;
+
+public class EditorInfo {
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/keyboard/Key.java b/tools/dicttool/compat/com/android/inputmethod/keyboard/Key.java
new file mode 100644
index 000000000..1e63bb526
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/keyboard/Key.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public class Key {
+ public final int getX() { return 0; }
+ public final int getY() { return 0; }
+ public final int getWidth() { return 0; }
+ public final int getHeight() { return 0; }
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/keyboard/Keyboard.java b/tools/dicttool/compat/com/android/inputmethod/keyboard/Keyboard.java
new file mode 100644
index 000000000..61b209f4d
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/keyboard/Keyboard.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+public class Keyboard {
+ private final Key KEY = new Key();
+ public final Key getKey(final int i) { return KEY; }
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/keyboard/ProximityInfo.java b/tools/dicttool/compat/com/android/inputmethod/keyboard/ProximityInfo.java
new file mode 100644
index 000000000..561b6637c
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public class ProximityInfo {
+ public long getNativeProximityInfo() { return 0l; }
+ private static native long setProximityInfoNative(String locale,
+ int displayWidth, int displayHeight, int gridWidth, int gridHeight,
+ int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray,
+ int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths,
+ int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
+ float[] sweetSpotCenterYs, float[] sweetSpotRadii);
+ private static native void releaseProximityInfoNative(long nativeProximityInfo);
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/latin/LatinIME.java b/tools/dicttool/compat/com/android/inputmethod/latin/LatinIME.java
new file mode 100644
index 000000000..e7aa340fb
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/latin/LatinIME.java
@@ -0,0 +1,20 @@
+/*
+ * 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;
+
+public class LatinIME {
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java b/tools/dicttool/compat/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java
new file mode 100644
index 000000000..6a430d57d
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/latin/settings/AdditionalFeaturesSettingUtils.java
@@ -0,0 +1,21 @@
+/*
+ * 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.settings;
+
+public class AdditionalFeaturesSettingUtils {
+ public static final int ADDITIONAL_FEATURES_SETTINGS_SIZE = 0;
+}
diff --git a/tools/dicttool/compat/com/android/inputmethod/latin/settings/SettingsValues.java b/tools/dicttool/compat/com/android/inputmethod/latin/settings/SettingsValues.java
new file mode 100644
index 000000000..0a84cdeee
--- /dev/null
+++ b/tools/dicttool/compat/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -0,0 +1,23 @@
+/*
+ * 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.settings;
+
+public class SettingsValues {
+ public boolean isWordCodePoint(final int code) {
+ return Character.isLetter(code);
+ }
+}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
index 4b6716936..16f82dafd 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/CombinedInputOutput.java
@@ -50,8 +50,6 @@ public class CombinedInputOutput {
private static final String NOT_A_WORD_TAG = "not_a_word";
private static final String WHITELIST_TAG = "whitelist";
private static final String OPTIONS_TAG = "options";
- private static final String GERMAN_UMLAUT_PROCESSING_OPTION = "german_umlaut_processing";
- private static final String FRENCH_LIGATURE_PROCESSING_OPTION = "french_ligature_processing";
private static final String COMMENT_LINE_STARTER = "#";
/**
@@ -112,13 +110,9 @@ public class CombinedInputOutput {
attributes.put(keyValue[0], keyValue[1]);
}
- final boolean processUmlauts =
- GERMAN_UMLAUT_PROCESSING_OPTION.equals(attributes.get(OPTIONS_TAG));
- final boolean processLigatures =
- FRENCH_LIGATURE_PROCESSING_OPTION.equals(attributes.get(OPTIONS_TAG));
attributes.remove(OPTIONS_TAG);
- final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), new DictionaryOptions(
- attributes, processUmlauts, processLigatures));
+ final FusionDictionary dict =
+ new FusionDictionary(new PtNodeArray(), new DictionaryOptions(attributes));
String line;
String word = null;
@@ -216,11 +210,6 @@ public class CombinedInputOutput {
destination.write(options.get(DICTIONARY_TAG));
options.remove(DICTIONARY_TAG);
}
- if (dict.mOptions.mGermanUmlautProcessing) {
- destination.write("," + OPTIONS_TAG + "=" + GERMAN_UMLAUT_PROCESSING_OPTION);
- } else if (dict.mOptions.mFrenchLigatureProcessing) {
- destination.write("," + OPTIONS_TAG + "=" + FRENCH_LIGATURE_PROCESSING_OPTION);
- }
for (final String key : dict.mOptions.mAttributes.keySet()) {
final String value = dict.mOptions.mAttributes.get(key);
destination.write("," + key + "=" + value);
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
index 5c7e8b4f2..143bce5ac 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -23,7 +23,7 @@ import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.MakedictLog;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
-import com.android.inputmethod.latin.makedict.Ver3DictEncoder;
+import com.android.inputmethod.latin.makedict.Ver2DictEncoder;
import com.android.inputmethod.latin.makedict.Ver4DictEncoder;
import java.io.BufferedWriter;
@@ -46,7 +46,6 @@ public class DictionaryMaker {
static class Arguments {
private static final String OPTION_VERSION_2 = "-2";
- private static final String OPTION_VERSION_3 = "-3";
private static final String OPTION_VERSION_4 = "-4";
private static final String OPTION_INPUT_SOURCE = "-s";
private static final String OPTION_INPUT_BIGRAM_XML = "-b";
@@ -158,10 +157,8 @@ public class DictionaryMaker {
if (arg.charAt(0) == '-') {
if (OPTION_VERSION_2.equals(arg)) {
// Do nothing, this is the default
- } else if (OPTION_VERSION_3.equals(arg)) {
- outputBinaryFormatVersion = 3;
} else if (OPTION_VERSION_4.equals(arg)) {
- outputBinaryFormatVersion = 4;
+ outputBinaryFormatVersion = FormatSpec.VERSION4;
} else if (OPTION_HELP.equals(arg)) {
displayHelp();
} else {
@@ -358,10 +355,10 @@ public class DictionaryMaker {
final File outputFile = new File(outputFilename);
final FormatSpec.FormatOptions formatOptions = new FormatSpec.FormatOptions(version);
final DictEncoder dictEncoder;
- if (version == 4) {
+ if (version == FormatSpec.VERSION4) {
dictEncoder = new Ver4DictEncoder(outputFile);
} else {
- dictEncoder = new Ver3DictEncoder(outputFile);
+ dictEncoder = new Ver2DictEncoder(outputFile);
}
dictEncoder.writeDictionary(dict, formatOptions);
}
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
index 66fd084cd..7ac3c67a1 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Diff.java
@@ -85,18 +85,6 @@ public class Diff extends Dicttool.Command {
private static void diffHeaders(final FusionDictionary dict0, final FusionDictionary dict1) {
boolean hasDifferences = false;
- if (dict0.mOptions.mFrenchLigatureProcessing != dict1.mOptions.mFrenchLigatureProcessing) {
- System.out.println(" French ligature processing : "
- + dict0.mOptions.mFrenchLigatureProcessing + " <=> "
- + dict1.mOptions.mFrenchLigatureProcessing);
- hasDifferences = true;
- }
- else if (dict0.mOptions.mGermanUmlautProcessing != dict1.mOptions.mGermanUmlautProcessing) {
- System.out.println(" German umlaut processing : "
- + dict0.mOptions.mGermanUmlautProcessing + " <=> "
- + dict1.mOptions.mGermanUmlautProcessing);
- hasDifferences = true;
- }
final HashMap<String, String> options1 =
new HashMap<String, String>(dict1.mOptions.mAttributes);
for (final String optionKey : dict0.mOptions.mAttributes.keySet()) {
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 9174238da..48817b1b1 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/Test.java
@@ -18,7 +18,6 @@ package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderEncoderTests;
import com.android.inputmethod.latin.makedict.BinaryDictEncoderFlattenTreeTests;
-import com.android.inputmethod.latin.makedict.BinaryDictIOUtilsTests;
import com.android.inputmethod.latin.makedict.FusionDictionaryTest;
import java.lang.reflect.Constructor;
@@ -31,15 +30,15 @@ import java.util.ArrayList;
*/
public class Test extends Dicttool.Command {
public static final String COMMAND = "test";
+ private static final int DEFAULT_MAX_UNIGRAMS = 1500;
private long mSeed = System.currentTimeMillis();
- private int mMaxUnigrams = BinaryDictIOUtilsTests.DEFAULT_MAX_UNIGRAMS;
+ private int mMaxUnigrams = DEFAULT_MAX_UNIGRAMS;
private static final Class<?>[] sClassesToTest = {
BinaryDictOffdeviceUtilsTests.class,
FusionDictionaryTest.class,
BinaryDictDecoderEncoderTests.class,
BinaryDictEncoderFlattenTreeTests.class,
- BinaryDictIOUtilsTests.class
};
private ArrayList<Method> mAllTestMethods = new ArrayList<Method>();
private ArrayList<String> mUsedTestMethods = new ArrayList<String>();
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
index 4e99bf979..d226251c1 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/XmlDictInputOutput.java
@@ -57,8 +57,6 @@ public class XmlDictInputOutput {
private static final String NOT_A_WORD_ATTR = "not_a_word";
private static final String OPTIONS_KEY = "options";
- private static final String GERMAN_UMLAUT_PROCESSING_OPTION = "german_umlaut_processing";
- private static final String FRENCH_LIGATURE_PROCESSING_OPTION = "french_ligature_processing";
/**
* SAX handler for a unigram XML file.
@@ -120,12 +118,8 @@ public class XmlDictInputOutput {
attributes.put(attrName, attrs.getValue(attrIndex));
}
final String optionsString = attributes.get(OPTIONS_KEY);
- final boolean processUmlauts =
- GERMAN_UMLAUT_PROCESSING_OPTION.equals(optionsString);
- final boolean processLigatures =
- FRENCH_LIGATURE_PROCESSING_OPTION.equals(optionsString);
mDictionary = new FusionDictionary(new PtNodeArray(),
- new DictionaryOptions(attributes, processUmlauts, processLigatures));
+ new DictionaryOptions(attributes));
} else {
mState = UNKNOWN;
}
@@ -361,11 +355,6 @@ public class XmlDictInputOutput {
// TODO: use an XMLSerializer if this gets big
destination.write("<wordlist format=\"2\"");
final HashMap<String, String> options = dict.mOptions.mAttributes;
- if (dict.mOptions.mGermanUmlautProcessing) {
- destination.write(" " + OPTIONS_KEY + "=\"" + GERMAN_UMLAUT_PROCESSING_OPTION + "\"");
- } else if (dict.mOptions.mFrenchLigatureProcessing) {
- destination.write(" " + OPTIONS_KEY + "=\"" + FRENCH_LIGATURE_PROCESSING_OPTION + "\"");
- }
for (final String key : dict.mOptions.mAttributes.keySet()) {
final String value = dict.mOptions.mAttributes.get(key);
destination.write(" " + key + "=\"" + value + "\"");
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index 1baeb7a47..0c11f868e 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -24,7 +24,7 @@ import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
-import com.android.inputmethod.latin.makedict.Ver3DictEncoder;
+import com.android.inputmethod.latin.makedict.Ver2DictEncoder;
import junit.framework.TestCase;
@@ -42,10 +42,16 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
private static final int TEST_FREQ = 37; // Some arbitrary value unlikely to happen by chance
public void testGetRawDictWorks() throws IOException, UnsupportedFormatException {
+ final String VERSION = "1";
+ final String LOCALE = "test";
+ final String ID = "main:test";
+
// Create a thrice-compressed dictionary file.
- final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
- new DictionaryOptions(new HashMap<String, String>(),
- false /* germanUmlautProcessing */, false /* frenchLigatureProcessing */));
+ final DictionaryOptions testOptions = new DictionaryOptions(new HashMap<String, String>());
+ testOptions.mAttributes.put(FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE, VERSION);
+ testOptions.mAttributes.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE, LOCALE);
+ testOptions.mAttributes.put(FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE, ID);
+ final FusionDictionary dict = new FusionDictionary(new PtNodeArray(), testOptions);
dict.add("foo", TEST_FREQ, null, false /* isNotAWord */);
dict.add("fta", 1, null, false /* isNotAWord */);
dict.add("ftb", 1, null, false /* isNotAWord */);
@@ -59,7 +65,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
Compress.getCompressedStream(
Compress.getCompressedStream(
new BufferedOutputStream(new FileOutputStream(dst)))));
- final DictEncoder dictEncoder = new Ver3DictEncoder(out);
+ final DictEncoder dictEncoder = new Ver2DictEncoder(out);
dictEncoder.writeDictionary(dict, new FormatOptions(2, false));
// Test for an actually compressed dictionary and its contents
@@ -73,6 +79,12 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
final FusionDictionary resultDict = dictDecoder.readDictionaryBinary(
null /* dict : an optional dictionary to add words to, or null */,
false /* deleteDictIfBroken */);
+ assertEquals("Wrong version attribute", VERSION, resultDict.mOptions.mAttributes.get(
+ FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE));
+ assertEquals("Wrong locale attribute", LOCALE, resultDict.mOptions.mAttributes.get(
+ FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE));
+ assertEquals("Wrong id attribute", ID, resultDict.mOptions.mAttributes.get(
+ FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE));
assertEquals("Dictionary can't be read back correctly",
FusionDictionary.findWordInTree(resultDict.mRootNodeArray, "foo").getFrequency(),
TEST_FREQ);
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/BinaryDictEncoderFlattenTreeTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/BinaryDictEncoderFlattenTreeTests.java
index 55058238c..c6e497615 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/BinaryDictEncoderFlattenTreeTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/BinaryDictEncoderFlattenTreeTests.java
@@ -32,8 +32,7 @@ public class BinaryDictEncoderFlattenTreeTests extends TestCase {
// that it does not contain any duplicates.
public void testFlattenNodes() {
final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
- new DictionaryOptions(new HashMap<String, String>(),
- false /* germanUmlautProcessing */, false /* frenchLigatureProcessing */));
+ new DictionaryOptions(new HashMap<String, String>()));
dict.add("foo", 1, null, false /* isNotAWord */);
dict.add("fta", 1, null, false /* isNotAWord */);
dict.add("ftb", 1, null, false /* isNotAWord */);
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
index 659650a05..76dadc25c 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
@@ -96,8 +96,7 @@ public class FusionDictionaryTest extends TestCase {
// that it does not contain any duplicates.
public void testFusion() {
final FusionDictionary dict = new FusionDictionary(new PtNodeArray(),
- new DictionaryOptions(new HashMap<String, String>(),
- false /* germanUmlautProcessing */, false /* frenchLigatureProcessing */));
+ new DictionaryOptions(new HashMap<String, String>()));
final long time = System.currentTimeMillis();
prepare(time);
for (int i = 0; i < sWords.size(); ++i) {
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
index 4cd9c236b..a8ac981e0 100644
--- 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
@@ -87,11 +87,11 @@ public final class KeyboardTextsSet {
return (text == null) ? LANGUAGE_DEFAULT[id] : text;
}
+ // These texts' name should be aligned with the @string/<name> in
+ // values*/strings-action-keys.xml.
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",
@@ -113,6 +113,8 @@ public final class KeyboardTextsSet {
};
/* @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 = {
/* @LANGUAGES_AND_TEXTS@ */
};
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..f8050a395 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">&#x060C;</string>
<string name="more_keys_for_comma">"\\,"</string>
+ <!-- U+0651: "ّ" ARABIC SHADDA -->
+ <string name="keyhintlabel_for_period">&#x0651;</string>
+ <string name="more_keys_for_period">!text/more_keys_for_arabic_diacritics</string>
+ <string name="keyhintlabel_for_tablet_period">&#x0651;</string>
+ <string name="more_keys_for_tablet_period">!text/more_keys_for_arabic_diacritics</string>
<string name="keylabel_for_symbols_question">&#x061F;</string>
<string name="keylabel_for_symbols_semicolon">&#x061B;</string>
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
<string name="keylabel_for_symbols_percent">&#x066A;</string>
- <string name="more_keys_for_symbols_question">\?</string>
+ <!-- U+00BF: "¿" INVERTED QUESTION MARK -->
+ <string name="more_keys_for_question">\?,&#x00BF;</string>
<string name="more_keys_for_symbols_semicolon">;</string>
<!-- U+2030: "‰" PER MILLE SIGN -->
<string name="more_keys_for_symbols_percent">\\%,&#x2030;</string>
- <!-- U+060C: "،" ARABIC COMMA
- U+061B: "؛" ARABIC SEMICOLON
- U+061F: "؟" ARABIC QUESTION MARK -->
- <string name="keylabel_for_apostrophe">&#x060C;</string>
- <string name="keyhintlabel_for_apostrophe">&#x061F;</string>
<!-- U+061F: "؟" ARABIC QUESTION MARK
U+060C: "،" ARABIC COMMA
U+061B: "؛" ARABIC SEMICOLON -->
+ <string name="keylabel_for_tablet_comma">"&#x060C;"</string>
+ <string name="keyhintlabel_for_tablet_comma">"&#x061F;"</string>
+ <string name="more_keys_for_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,/,\",\'"</string>
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,\",\',#,-,:,!,&#x060C;,&#x061F;,\@,&amp;,\\%,+,&#x061B;,/,(|),)|("</string>
- <string name="more_keys_for_apostrophe">"&#x061F;,&#x061B;,!,:,-,/,\',\""</string>
<!-- U+266A: "♪" EIGHTH NOTE -->
<string name="more_keys_for_bullet">&#x266A;</string>
<!-- U+2605: "★" BLACK STAR
@@ -121,5 +124,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,&#x20;&#x0655;|&#x0655;,&#x20;&#x0654;|&#x0654;,&#x20;&#x0652;|&#x0652;,&#x20;&#x064D;|&#x064D;,&#x20;&#x064C;|&#x064C;,&#x20;&#x064B;|&#x064B;,&#x20;&#x0651;|&#x0651;,&#x20;&#x0656;|&#x0656;,&#x20;&#x0670;|&#x0670;,&#x20;&#x0653;|&#x0653;,&#x20;&#x0650;|&#x0650;,&#x20;&#x064F;|&#x064F;,&#x20;&#x064E;|&#x064E;,&#x0640;&#x0640;&#x0640;|&#x0640;"</string>
- <string name="keyhintlabel_for_arabic_diacritics">&#x0651;</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..f63e85bd5 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
@@ -72,7 +72,7 @@
<string name="more_keys_for_l">l&#x00B7;l,&#x0142;</string>
<!-- U+00B7: "·" MIDDLE DOT -->
<string name="more_keys_for_punctuation">"!fixedColumnOrder!9,;,/,(,),#,&#x00B7;,!,\\,,\?,&amp;,\\%,+,\",-,:,',\@"</string>
- <string name="more_keys_for_period">\?,&#x00B7;</string>
+ <string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!8,;,/,(,),#,&#x00B7;,',\\,,&amp;,\\%,+,\",-,:,\@"</string>
<!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA -->
<string name="keylabel_for_spanish_row2_10">&#x00E7;</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">&#x00F1;,&#x0144;</string>
+ <!-- U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS -->
+ <string name="keylabel_for_swiss_row1_11">&#x00FC;</string>
+ <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE -->
+ <string name="more_keys_for_swiss_row1_11">&#x00E8;</string>
+ <!-- U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS -->
+ <string name="keylabel_for_swiss_row2_10">&#x00F6;</string>
+ <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE -->
+ <string name="more_keys_for_swiss_row2_10">&#x00E9;</string>
+ <!-- U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS -->
+ <string name="keylabel_for_swiss_row2_11">&#x00E4;</string>
+ <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE -->
+ <string name="more_keys_for_swiss_row2_11">&#x00E0;</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..f4fe7f787 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">&#x00E7;,&#x0107;,&#x010D;</string>
- <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
- <string name="keylabel_for_spanish_row2_10">&#x00F1;</string>
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK
U+00BF: "¿" INVERTED QUESTION MARK -->
- <string name="more_keys_for_punctuation">"!fixedColumnOrder!4,;,!,\\,,\?,:,&#x00A1;,\@,&#x00BF;"</string>
- <!-- U+00A1: "¡" INVERTED EXCLAMATION MARK -->
- <string name="more_keys_for_tablet_comma">"!,&#x00A1;"</string>
- <!-- U+00BF: "¿" INVERTED QUESTION MARK -->
- <string name="more_keys_for_period">"\?,&#x00BF;"</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,&#x00A1;,;,/,(,),#,!,\\,,\?,&#x00BF;,&amp;,\\%,+,\",-,:,',\@"</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..5bcfe7fc9 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">&#x060C;</string>
<string name="more_keys_for_comma">"\\,"</string>
+ <!-- U+064B: "ً" ARABIC FATHATAN -->
+ <string name="keyhintlabel_for_period">&#x064B;</string>
+ <string name="more_keys_for_period">!text/more_keys_for_arabic_diacritics</string>
+ <string name="keyhintlabel_for_tablet_period">&#x064B;</string>
+ <string name="more_keys_for_tablet_period">!text/more_keys_for_arabic_diacritics</string>
<string name="keylabel_for_symbols_question">&#x061F;</string>
<string name="keylabel_for_symbols_semicolon">&#x061B;</string>
<!-- U+066A: "٪" ARABIC PERCENT SIGN -->
<string name="keylabel_for_symbols_percent">&#x066A;</string>
- <string name="more_keys_for_symbols_question">\?</string>
+ <!-- U+00BF: "¿" INVERTED QUESTION MARK -->
+ <string name="more_keys_for_question">\?,&#x00BF;</string>
<string name="more_keys_for_symbols_semicolon">;</string>
<!-- U+2030: "‰" PER MILLE SIGN -->
<string name="more_keys_for_symbols_percent">\\%,&#x2030;</string>
@@ -79,13 +85,9 @@
U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
U+00BB: "»" RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -->
<string name="keylabel_for_tablet_comma">"&#x060C;"</string>
- <string name="keyhintlabel_for_tablet_comma">"!"</string>
- <string name="more_keys_for_tablet_comma">"!,\\,"</string>
+ <string name="keyhintlabel_for_tablet_comma">"&#x061F;"</string>
+ <string name="more_keys_for_tablet_comma">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,/,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;"</string>
<string name="keyhintlabel_for_period">"&#x061F;"</string>
- <string name="more_keys_for_period">"&#x061F;,\?"</string>
- <string name="keylabel_for_apostrophe">&#x060C;</string>
- <string name="keyhintlabel_for_apostrophe">&#x061F;</string>
- <string name="more_keys_for_apostrophe">"!fixedColumnOrder!4,:,!,&#x061F;,&#x061B;,-,/,&#x00AB;|&#x00BB;,&#x00BB;|&#x00AB;"</string>
<!-- U+FDFC: "﷼" RIAL SIGN -->
<string name="keylabel_for_currency">&#xFDFC;</string>
<!-- U+061F: "؟" ARABIC QUESTION MARK
@@ -130,5 +132,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,&#x20;&#x0655;|&#x0655;,&#x20;&#x0652;|&#x0652;,&#x20;&#x0651;|&#x0651;,&#x20;&#x064C;|&#x064C;,&#x20;&#x064D;|&#x064D;,&#x20;&#x064B;|&#x064B;,&#x20;&#x0654;|&#x0654;,&#x20;&#x0656;|&#x0656;,&#x20;&#x0670;|&#x0670;,&#x20;&#x0653;|&#x0653;,&#x20;&#x064F;|&#x064F;,&#x20;&#x0650;|&#x0650;,&#x20;&#x064E;|&#x064E;,&#x0640;&#x0640;&#x0640;|&#x0640;"</string>
- <string name="keyhintlabel_for_arabic_diacritics">&#x064B;</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">&#x00E7;,&#x0107;,&#x010D;</string>
<!-- U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS -->
<string name="more_keys_for_y">%,&#x00FF;</string>
+ <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE -->
+ <string name="keylabel_for_swiss_row1_11">&#x00E8;</string>
+ <!-- U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS -->
+ <string name="more_keys_for_swiss_row1_11">&#x00FC;</string>
+ <!-- U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE -->
+ <string name="keylabel_for_swiss_row2_10">&#x00E9;</string>
+ <!-- U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS -->
+ <string name="more_keys_for_swiss_row2_10">&#x00F6;</string>
+ <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE -->
+ <string name="keylabel_for_swiss_row2_11">&#x00E0;</string>
+ <!-- U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS -->
+ <string name="more_keys_for_swiss_row2_11">&#x00E4;</string>
</resources>
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..73fe927ab 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
@@ -26,15 +26,21 @@
<!-- U+055A: "՚" ARMENIAN APOSTROPHE -->
<!-- U+055B: "՛" ARMENIAN EMPHASIS MARK -->
<!-- U+055F: "՟" ARMENIAN ABBREVIATION MARK -->
- <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,!,?,\\,,.,&#x058A;,&#x055C;,&#x055D;,&#x055E;,:,;,\@,&#x0559;,&#x055A;,&#x055B;,&#x055F;"</string>
+ <string name="more_keys_for_punctuation">"!fixedColumnOrder!8,!,?,&#x0559;,&#x055A;,.,&#x055C;,\\,,&#x055E;,:,;,&#x055F;,&#x00AB;,&#x00BB;,&#x058A;,&#x055D;,&#x055B;"</string>
<!-- U+055E: "՞" ARMENIAN QUESTION MARK -->
<!-- U+00BF: "¿" INVERTED QUESTION MARK -->
- <string name="more_keys_for_symbols_question">&#x055E;,&#x00BF;</string>
+ <string name="more_keys_for_question">&#x055E;,&#x00BF;</string>
<!-- U+055C: "՜" ARMENIAN EXCLAMATION MARK -->
<!-- U+00A1: "¡" INVERTED EXCLAMATION MARK -->
- <string name="more_keys_for_symbols_exclamation">&#x055C;,&#x00A1;</string>
+ <string name="more_keys_for_exclamation">&#x055C;,&#x00A1;</string>
<!-- U+058F: "֏" ARMENIAN DRAM SIGN -->
<!-- TODO: Enable this when we have glyph for the following letter
<string name="keylabel_for_currency">&#x058F;</string>
-->
+ <!-- U+055D: "՝" ARMENIAN COMMA -->
+ <string name="keylabel_for_tablet_comma">&#x055D;</string>
+ <!-- U+0589: "։" ARMENIAN FULL STOP -->
+ <string name="keylabel_for_period">&#x0589;</string>
+ <string name="keylabel_for_tablet_period">&#x0589;</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..e231a398e 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
@@ -29,6 +29,7 @@
U+FB29: "﬩" HEBREW LETTER ALTERNATIVE PLUS SIGN -->
<string name="more_keys_for_plus">&#x00B1;,&#xFB29;</string>
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,(|),)|(,#,!,\\,,\?,&amp;,\\%,+,\",-,:,',\@"</string>
+ <string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!7,;,/,(|),)|(,#,',\\,,&amp;,\\%,+,\",-,:,\@"</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,&lt;|&gt;,{|},[|]</string>
@@ -54,8 +55,4 @@
<string name="double_angle_quotes">!text/double_laqm_raqm_rtl</string>
<!-- U+20AA: "₪" NEW SHEQEL SIGN -->
<string name="keylabel_for_currency">&#x20AA;</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..9205e5309 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
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..ceb46dcd2 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>
@@ -78,6 +84,7 @@
<string name="keylabel_for_currency">$</string>
<string name="more_keys_for_currency">$,&#x00A2;,&#x20AC;,&#x00A3;,&#x00A5;,&#x20B1;</string>
<string name="more_keys_for_punctuation">"!fixedColumnOrder!8,;,/,(,),#,!,\\,,\?,&amp;,\\%,+,\",-,:,',\@"</string>
+ <string name="more_keys_for_tablet_punctuation">"!fixedColumnOrder!7,;,/,(,),#,',\\,,&amp;,\\%,+,\",-,:,\@"</string>
<!-- U+2020: "†" DAGGER
U+2021: "‡" DOUBLE DAGGER
U+2605: "★" BLACK STAR -->
@@ -103,7 +110,6 @@
<string name="more_keys_for_less_than">!fixedColumnOrder!3,&#x2039;,&#x2264;,&#x00AB;</string>
<string name="more_keys_for_greater_than">!fixedColumnOrder!3,&#x203A;,&#x2265;,&#x00BB;</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>
@@ -154,34 +160,37 @@
<!-- U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N
U+2205: "∅" EMPTY SET -->
<string name="more_keys_for_symbols_0">&#x207F;,&#x2205;</string>
+ <!-- Comma key -->
<string name="keylabel_for_comma">,</string>
<string name="more_keys_for_comma"></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">&#x00A1;</string>
+ <string name="more_keys_for_exclamation">&#x00A1;</string>
<!-- U+00BF: "¿" INVERTED QUESTION MARK -->
- <string name="more_keys_for_symbols_question">&#x00BF;</string>
+ <string name="more_keys_for_question">&#x00BF;</string>
<string name="more_keys_for_symbols_semicolon"></string>
<!-- U+2030: "‰" PER MILLE SIGN -->
<string name="more_keys_for_symbols_percent">&#x2030;</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">&#x2026;</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>
+ <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
+ <string name="keylabel_for_spanish_row2_10">&#x00F1;</string>
<string name="more_keys_for_am_pm">!fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/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>
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..a88383025 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
@@ -37,7 +37,7 @@ public class MoreKeysResources {
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 DEFAULT_LANGUAGE_NAME = "DEFAULT";
private static final String ARRAY_NAME_FOR_LANGUAGE = "LANGUAGE_%s";
private static final String EMPTY_STRING_VAR = "EMPTY";
@@ -72,7 +72,7 @@ public class MoreKeysResources {
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 +84,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,7 +133,7 @@ public class MoreKeysResources {
}
private void dumpNames(final PrintStream out) {
- final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME);
+ final StringResourceMap defaultResMap = mResourcesMap.get(DEFAULT_LANGUAGE_NAME);
int id = 0;
for (final StringResource res : defaultResMap.getResources()) {
out.format(" /* %2d */ \"%s\",\n", id, res.mName);
@@ -141,17 +143,17 @@ public class MoreKeysResources {
}
private void dumpDefaultTexts(final PrintStream out) {
- final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME);
+ final StringResourceMap defaultResMap = mResourcesMap.get(DEFAULT_LANGUAGE_NAME);
dumpTextsInternal(out, defaultResMap, defaultResMap);
}
private void dumpTexts(final PrintStream out) {
- final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME);
+ final StringResourceMap defaultResMap = mResourcesMap.get(DEFAULT_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)) {
+ if (language.equals(DEFAULT_LANGUAGE_NAME)) {
continue;
}
out.format(" /* Language %s: %s */\n", language, getLanguageDisplayName(language));
@@ -174,17 +176,22 @@ public class MoreKeysResources {
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));
+ final Locale locale = LocaleUtils.constructLocaleFromString(language);
+ // If we use a different key, dump the original as comment for now.
+ final String languageKeyToDump = locale.getCountry().isEmpty()
+ ? String.format("\"%s\"", language)
+ : String.format("\"%s\" /* \"%s\" */", locale.getLanguage(), language);
+ out.format(" %s, " + ARRAY_NAME_FOR_LANGUAGE + ", /* %s */\n",
+ languageKeyToDump, language, 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,