From ca6acfdd6b3400ad6e29d45c29b0ec40ea92a968 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 13 Aug 2013 12:34:01 +0900 Subject: Rename maketext tool to make-keyboard-text Change-Id: Icceda22aec75f9e3602da8775c0e94b110283575 --- tools/make-keyboard-text/Android.mk | 25 ++ tools/make-keyboard-text/etc/Android.mk | 20 ++ tools/make-keyboard-text/etc/make-keyboard-text | 63 +++++ tools/make-keyboard-text/etc/manifest.txt | 1 + .../keyboard/internal/KeyboardTextsSet.tmpl | 132 +++++++++++ .../res/values-af/donottranslate-more-keys.xml | 69 ++++++ .../res/values-ar/donottranslate-more-keys.xml | 125 ++++++++++ .../res/values-az/donottranslate-more-keys.xml | 59 +++++ .../res/values-be/donottranslate-more-keys.xml | 42 ++++ .../res/values-bg/donottranslate-more-keys.xml | 28 +++ .../res/values-ca/donottranslate-more-keys.xml | 78 ++++++ .../res/values-cs/donottranslate-more-keys.xml | 91 +++++++ .../res/values-da/donottranslate-more-keys.xml | 75 ++++++ .../res/values-de/donottranslate-more-keys.xml | 62 +++++ .../res/values-el/donottranslate-more-keys.xml | 26 ++ .../res/values-en/donottranslate-more-keys.xml | 63 +++++ .../res/values-eo/donottranslate-more-keys.xml | 146 ++++++++++++ .../res/values-es/donottranslate-more-keys.xml | 82 +++++++ .../res/values-et/donottranslate-more-keys.xml | 116 +++++++++ .../res/values-fa/donottranslate-more-keys.xml | 132 +++++++++++ .../res/values-fi/donottranslate-more-keys.xml | 56 +++++ .../res/values-fr/donottranslate-more-keys.xml | 68 ++++++ .../res/values-hi/donottranslate-more-keys.xml | 63 +++++ .../res/values-hr/donottranslate-more-keys.xml | 42 ++++ .../res/values-hu/donottranslate-more-keys.xml | 66 ++++++ .../res/values-is/donottranslate-more-keys.xml | 75 ++++++ .../res/values-it/donottranslate-more-keys.xml | 62 +++++ .../res/values-iw/donottranslate-more-keys.xml | 55 +++++ .../res/values-ka/donottranslate-more-keys.xml | 28 +++ .../res/values-kk/donottranslate-more-keys.xml | 57 +++++ .../res/values-ky/donottranslate-more-keys.xml | 46 ++++ .../res/values-lt/donottranslate-more-keys.xml | 109 +++++++++ .../res/values-lv/donottranslate-more-keys.xml | 108 +++++++++ .../res/values-mk/donottranslate-more-keys.xml | 40 ++++ .../res/values-mn/donottranslate-more-keys.xml | 28 +++ .../res/values-nb/donottranslate-more-keys.xml | 62 +++++ .../res/values-nl/donottranslate-more-keys.xml | 68 ++++++ .../res/values-pl/donottranslate-more-keys.xml | 67 ++++++ .../res/values-pt/donottranslate-more-keys.xml | 65 +++++ .../res/values-rm/donottranslate-more-keys.xml | 29 +++ .../res/values-ro/donottranslate-more-keys.xml | 47 ++++ .../res/values-ru/donottranslate-more-keys.xml | 42 ++++ .../res/values-sk/donottranslate-more-keys.xml | 111 +++++++++ .../res/values-sl/donottranslate-more-keys.xml | 34 +++ .../res/values-sr/donottranslate-more-keys.xml | 61 +++++ .../res/values-sv/donottranslate-more-keys.xml | 56 +++++ .../res/values-sw/donottranslate-more-keys.xml | 65 +++++ .../res/values-th/donottranslate-more-keys.xml | 28 +++ .../res/values-tl/donottranslate-more-keys.xml | 70 ++++++ .../res/values-tr/donottranslate-more-keys.xml | 57 +++++ .../res/values-uk/donottranslate-more-keys.xml | 46 ++++ .../res/values-vi/donottranslate-more-keys.xml | 97 ++++++++ .../res/values-zu/donottranslate-more-keys.xml | 64 +++++ .../res/values-zz/donottranslate-more-keys.xml | 139 +++++++++++ .../res/values/donottranslate-more-keys.xml | 250 +++++++++++++++++++ .../keyboard/tools/ArrayInitializerFormatter.java | 89 +++++++ .../inputmethod/keyboard/tools/JarUtils.java | 85 +++++++ .../keyboard/tools/MakeKeyboardText.java | 65 +++++ .../keyboard/tools/MoreKeysResources.java | 264 +++++++++++++++++++++ .../inputmethod/keyboard/tools/StringResource.java | 29 +++ .../keyboard/tools/StringResourceMap.java | 135 +++++++++++ tools/maketext/Android.mk | 25 -- tools/maketext/etc/Android.mk | 20 -- tools/maketext/etc/maketext | 63 ----- tools/maketext/etc/manifest.txt | 1 - .../keyboard/internal/KeyboardTextsSet.tmpl | 132 ----------- .../res/values-af/donottranslate-more-keys.xml | 69 ------ .../res/values-ar/donottranslate-more-keys.xml | 125 ---------- .../res/values-az/donottranslate-more-keys.xml | 59 ----- .../res/values-be/donottranslate-more-keys.xml | 42 ---- .../res/values-bg/donottranslate-more-keys.xml | 28 --- .../res/values-ca/donottranslate-more-keys.xml | 78 ------ .../res/values-cs/donottranslate-more-keys.xml | 91 ------- .../res/values-da/donottranslate-more-keys.xml | 75 ------ .../res/values-de/donottranslate-more-keys.xml | 62 ----- .../res/values-el/donottranslate-more-keys.xml | 26 -- .../res/values-en/donottranslate-more-keys.xml | 63 ----- .../res/values-eo/donottranslate-more-keys.xml | 146 ------------ .../res/values-es/donottranslate-more-keys.xml | 82 ------- .../res/values-et/donottranslate-more-keys.xml | 116 --------- .../res/values-fa/donottranslate-more-keys.xml | 132 ----------- .../res/values-fi/donottranslate-more-keys.xml | 56 ----- .../res/values-fr/donottranslate-more-keys.xml | 68 ------ .../res/values-hi/donottranslate-more-keys.xml | 63 ----- .../res/values-hr/donottranslate-more-keys.xml | 42 ---- .../res/values-hu/donottranslate-more-keys.xml | 66 ------ .../res/values-is/donottranslate-more-keys.xml | 75 ------ .../res/values-it/donottranslate-more-keys.xml | 62 ----- .../res/values-iw/donottranslate-more-keys.xml | 55 ----- .../res/values-ka/donottranslate-more-keys.xml | 28 --- .../res/values-kk/donottranslate-more-keys.xml | 57 ----- .../res/values-ky/donottranslate-more-keys.xml | 46 ---- .../res/values-lt/donottranslate-more-keys.xml | 109 --------- .../res/values-lv/donottranslate-more-keys.xml | 108 --------- .../res/values-mk/donottranslate-more-keys.xml | 40 ---- .../res/values-mn/donottranslate-more-keys.xml | 28 --- .../res/values-nb/donottranslate-more-keys.xml | 62 ----- .../res/values-nl/donottranslate-more-keys.xml | 68 ------ .../res/values-pl/donottranslate-more-keys.xml | 67 ------ .../res/values-pt/donottranslate-more-keys.xml | 65 ----- .../res/values-rm/donottranslate-more-keys.xml | 29 --- .../res/values-ro/donottranslate-more-keys.xml | 47 ---- .../res/values-ru/donottranslate-more-keys.xml | 42 ---- .../res/values-sk/donottranslate-more-keys.xml | 111 --------- .../res/values-sl/donottranslate-more-keys.xml | 34 --- .../res/values-sr/donottranslate-more-keys.xml | 61 ----- .../res/values-sv/donottranslate-more-keys.xml | 56 ----- .../res/values-sw/donottranslate-more-keys.xml | 65 ----- .../res/values-th/donottranslate-more-keys.xml | 28 --- .../res/values-tl/donottranslate-more-keys.xml | 70 ------ .../res/values-tr/donottranslate-more-keys.xml | 57 ----- .../res/values-uk/donottranslate-more-keys.xml | 46 ---- .../res/values-vi/donottranslate-more-keys.xml | 97 -------- .../res/values-zu/donottranslate-more-keys.xml | 64 ----- .../res/values-zz/donottranslate-more-keys.xml | 139 ----------- .../res/values/donottranslate-more-keys.xml | 250 ------------------- .../latin/maketext/ArrayInitializerFormatter.java | 89 ------- .../inputmethod/latin/maketext/JarUtils.java | 85 ------- .../inputmethod/latin/maketext/LabelText.java | 65 ----- .../latin/maketext/MoreKeysResources.java | 264 --------------------- .../inputmethod/latin/maketext/StringResource.java | 29 --- .../latin/maketext/StringResourceMap.java | 135 ----------- 122 files changed, 4463 insertions(+), 4463 deletions(-) create mode 100644 tools/make-keyboard-text/Android.mk create mode 100644 tools/make-keyboard-text/etc/Android.mk create mode 100755 tools/make-keyboard-text/etc/make-keyboard-text create mode 100644 tools/make-keyboard-text/etc/manifest.txt create mode 100644 tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl create mode 100644 tools/make-keyboard-text/res/values-af/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/res/values/donottranslate-more-keys.xml create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java create mode 100644 tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java delete mode 100644 tools/maketext/Android.mk delete mode 100644 tools/maketext/etc/Android.mk delete mode 100755 tools/maketext/etc/maketext delete mode 100644 tools/maketext/etc/manifest.txt delete mode 100644 tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl delete mode 100644 tools/maketext/res/values-af/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ar/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-az/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-be/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-bg/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ca/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-cs/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-da/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-de/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-el/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-en/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-eo/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-es/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-et/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-fa/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-fi/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-fr/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-hi/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-hr/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-hu/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-is/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-it/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-iw/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ka/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-kk/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ky/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-lt/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-lv/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-mk/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-mn/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-nb/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-nl/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-pl/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-pt/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-rm/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ro/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-ru/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-sk/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-sl/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-sr/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-sv/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-sw/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-th/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-tl/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-tr/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-uk/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-vi/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-zu/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values-zz/donottranslate-more-keys.xml delete mode 100644 tools/maketext/res/values/donottranslate-more-keys.xml delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java delete mode 100644 tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java (limited to 'tools') diff --git a/tools/make-keyboard-text/Android.mk b/tools/make-keyboard-text/Android.mk new file mode 100644 index 000000000..87601489e --- /dev/null +++ b/tools/make-keyboard-text/Android.mk @@ -0,0 +1,25 @@ +# +# 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. + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES += $(call all-java-files-under,src) +LOCAL_JAR_MANIFEST := etc/manifest.txt +LOCAL_JAVA_RESOURCE_DIRS := res +LOCAL_MODULE := make-keyboard-text + +include $(BUILD_HOST_JAVA_LIBRARY) +include $(LOCAL_PATH)/etc/Android.mk diff --git a/tools/make-keyboard-text/etc/Android.mk b/tools/make-keyboard-text/etc/Android.mk new file mode 100644 index 000000000..0fbf4ffe9 --- /dev/null +++ b/tools/make-keyboard-text/etc/Android.mk @@ -0,0 +1,20 @@ +# 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. + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_PREBUILT_EXECUTABLES := make-keyboard-text + +include $(BUILD_HOST_PREBUILT) diff --git a/tools/make-keyboard-text/etc/make-keyboard-text b/tools/make-keyboard-text/etc/make-keyboard-text new file mode 100755 index 000000000..156f9ec5f --- /dev/null +++ b/tools/make-keyboard-text/etc/make-keyboard-text @@ -0,0 +1,63 @@ +#!/bin/sh +# Copyright 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. + +# Set up prog to be the path of this script, including following symlinks, +# and set up progdir to be the fully-qualified pathname of its directory. +prog="$0" +while [ -h "${prog}" ]; do + newProg=`/bin/ls -ld "${prog}"` + newProg=`expr "${newProg}" : ".* -> \(.*\)$"` + if expr "x${newProg}" : 'x/' >/dev/null; then + prog="${newProg}" + else + progdir=`dirname "${prog}"` + prog="${progdir}/${newProg}" + fi +done +oldwd=`pwd` +progdir=`dirname "${prog}"` +cd "${progdir}" +progdir=`pwd` +prog="${progdir}"/`basename "${prog}"` +cd "${oldwd}" + +jarfile=make-keyboard-text.jar +frameworkdir="$progdir" +if [ ! -r "$frameworkdir/$jarfile" ] +then + frameworkdir=`dirname "$progdir"`/tools/lib + libdir=`dirname "$progdir"`/tools/lib +fi +if [ ! -r "$frameworkdir/$jarfile" ] +then + frameworkdir=`dirname "$progdir"`/framework + libdir=`dirname "$progdir"`/lib +fi +if [ ! -r "$frameworkdir/$jarfile" ] +then + echo `basename "$prog"`": can't find $jarfile" + exit 1 +fi + +if [ "$OSTYPE" = "cygwin" ] ; then + jarpath=`cygpath -w "$frameworkdir/$jarfile"` + progdir=`cygpath -w "$progdir"` +else + jarpath="$frameworkdir/$jarfile" +fi + +# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored +# might need more memory, e.g. -Xmx128M +exec java -ea -jar "$jarpath" "$@" diff --git a/tools/make-keyboard-text/etc/manifest.txt b/tools/make-keyboard-text/etc/manifest.txt new file mode 100644 index 000000000..8ad4db059 --- /dev/null +++ b/tools/make-keyboard-text/etc/manifest.txt @@ -0,0 +1 @@ +Main-Class: com.android.inputmethod.keyboard.tools.MakeKeyboardText 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 new file mode 100644 index 000000000..4cd9c236b --- /dev/null +++ b/tools/make-keyboard-text/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl @@ -0,0 +1,132 @@ +/* + * 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/" in keyboard XML definitions, + * and should be defined in + * tools/make-keyboard-text/res/values-/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 sLocaleToTextsMap = CollectionUtils.newHashMap(); + private static final HashMap sNameToIdsMap = CollectionUtils.newHashMap(); + + private String[] mTexts; + // Resource name to text map. + private HashMap 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/ 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/values-af/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-af/donottranslate-more-keys.xml new file mode 100644 index 000000000..ee96f442d --- /dev/null +++ b/tools/make-keyboard-text/res/values-af/donottranslate-more-keys.xml @@ -0,0 +1,69 @@ + + + + + + á,â,ä,à,æ,ã,å,ā + + é,è,ê,ë,ę,ė,ē + + í,ì,ï,î,į,ī,ij + + ó,ô,ö,ò,õ,œ,ø,ō + + ú,û,ü,ù,ū + + ñ,ń + ý,ŷ,ÿ,ij + + ý,ij + 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 new file mode 100644 index 000000000..8b86b1ba2 --- /dev/null +++ b/tools/make-keyboard-text/res/values-ar/donottranslate-more-keys.xml @@ -0,0 +1,125 @@ + + + + + أ‌ب‌ج + + ١ + + ٢ + + ٣ + + ٤ + + ٥ + + ٦ + + ٧ + + ٨ + + ٩ + + ٠ + + ٣٢١؟ + + ٣٢١ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + 0,٫,٬ + + ، + "\\," + ؟ + ؛ + + ٪ + \? + ; + + \\%,‰ + + ، + ؟ + + "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|(" + "؟,؛,!,:,-,/,\',\"" + + + + ★,٭ + + + !fixedColumnOrder!4,﴾|﴿,<|>,{|},[|] + !fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[ + + !fixedColumnOrder!3,‹|›,≤|≥,«|» + !fixedColumnOrder!3,›|‹,≥|≤,»|« + !text/single_laqm_raqm_rtl + !text/double_laqm_raqm_rtl + + + + + "!fixedColumnOrder!7, ٕ|ٕ, ٔ|ٔ, ْ|ْ, ٍ|ٍ, ٌ|ٌ, ً|ً, ّ|ّ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ِ|ِ, ُ|ُ, َ|َ,ـــ|ـ" + ّ + diff --git a/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml new file mode 100644 index 000000000..db1784c17 --- /dev/null +++ b/tools/make-keyboard-text/res/values-az/donottranslate-more-keys.xml @@ -0,0 +1,59 @@ + + + + + â + + ə + + ı,î,ï,ì,í,į,ī + + ö,ô,œ,ò,ó,õ,ø,ō + + ü,û,ù,ú,ū + + ş,ß,ś,š + + ğ + + ç,ć,č + diff --git a/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml new file mode 100644 index 000000000..4723503f1 --- /dev/null +++ b/tools/make-keyboard-text/res/values-be/donottranslate-more-keys.xml @@ -0,0 +1,42 @@ + + + + + ў + + ё + + ы + + э + + і + + ё + + ъ + + АБВ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml new file mode 100644 index 000000000..5262133de --- /dev/null +++ b/tools/make-keyboard-text/res/values-bg/donottranslate-more-keys.xml @@ -0,0 +1,28 @@ + + + + + АБВ + + !text/double_9qm_lqm + 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 new file mode 100644 index 000000000..8624dfb65 --- /dev/null +++ b/tools/make-keyboard-text/res/values-ca/donottranslate-more-keys.xml @@ -0,0 +1,78 @@ + + + + + à,á,ä,â,ã,å,ą,æ,ā,ª + + è,é,ë,ê,ę,ė,ē + + í,ï,ì,î,į,ī + + ò,ó,ö,ô,õ,ø,œ,ō,º + + ú,ü,ù,û,ū + + ñ,ń + + ç,ć,č + + l·l,ł + + "!fixedColumnOrder!9,·,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(,)" + \?,· + + ç + diff --git a/tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml new file mode 100644 index 000000000..5ce1d3bc8 --- /dev/null +++ b/tools/make-keyboard-text/res/values-cs/donottranslate-more-keys.xml @@ -0,0 +1,91 @@ + + + + + á,à,â,ä,æ,ã,å,ā + + é,ě,è,ê,ë,ę,ė,ē + + í,î,ï,ì,į,ī + + ó,ö,ô,ò,õ,œ,ø,ō + + ú,ů,û,ü,ù,ū + + š,ß,ś + + ň,ñ,ń + + č,ç,ć + + ý,ÿ + + ď + + ř + + ť + + ž,ź,ż + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml new file mode 100644 index 000000000..cbaf9f497 --- /dev/null +++ b/tools/make-keyboard-text/res/values-da/donottranslate-more-keys.xml @@ -0,0 +1,75 @@ + + + + + á,ä,à,â,ã,ā + + é,ë + + í,ï + + ó,ô,ò,õ,œ,ō + + ú,ü,û,ù,ū + + ß,ś,š + + ñ,ń + + ý,ÿ + + ð + + ł + + å + + æ + + ø + + ä + + ö + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + 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 new file mode 100644 index 000000000..9dc8717ec --- /dev/null +++ b/tools/make-keyboard-text/res/values-de/donottranslate-more-keys.xml @@ -0,0 +1,62 @@ + + + + + ä,â,à,á,æ,ã,å,ā + + é,è,ê,ë,ė + + ö,ô,ò,ó,õ,œ,ø,ō + + ü,û,ù,ú,ū + + ß,ś,š + + ñ,ń + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml new file mode 100644 index 000000000..964dba081 --- /dev/null +++ b/tools/make-keyboard-text/res/values-el/donottranslate-more-keys.xml @@ -0,0 +1,26 @@ + + + + + ΑΒΓ + diff --git a/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml new file mode 100644 index 000000000..969a5041b --- /dev/null +++ b/tools/make-keyboard-text/res/values-en/donottranslate-more-keys.xml @@ -0,0 +1,63 @@ + + + + + à,á,â,ä,æ,ã,å,ā + + è,é,ê,ë,ē + + î,ï,í,ī,ì + + ô,ö,ò,ó,œ,ø,ō,õ + + û,ü,ù,ú,ū + + ß + + ñ + + ç + diff --git a/tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml new file mode 100644 index 000000000..e929869e2 --- /dev/null +++ b/tools/make-keyboard-text/res/values-eo/donottranslate-more-keys.xml @@ -0,0 +1,146 @@ + + + + + á,à,â,ä,æ,ã,å,ā,ă,ą,ª + + é,ě,è,ê,ë,ę,ė,ē + + í,î,ï,ĩ,ì,į,ī,ı,ij + + ó,ö,ô,ò,õ,œ,ø,ō,ő,º + + ú,ů,û,ü,ù,ū,ũ,ű,ų,µ + + ß,š,ś,ș,ş + + ñ,ń,ņ,ň,ʼn,ŋ + + ć,č,ç,ċ + + y,ý,ŷ,ÿ,þ + + ð,ď,đ + + ř,ŕ,ŗ + + ť,ț,ţ,ŧ + + ź,ż,ž + + ķ,ĸ + + ĺ,ļ,ľ,ŀ,ł + + ğ,ġ,ģ + + w,ŵ + + ĥ,ħ + + w,ŵ + q + x + + ŝ + + ĝ + + ŭ + + ĉ + + ĵ + 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 new file mode 100644 index 000000000..0e58c1440 --- /dev/null +++ b/tools/make-keyboard-text/res/values-es/donottranslate-more-keys.xml @@ -0,0 +1,82 @@ + + + + + á,à,ä,â,ã,å,ą,æ,ā,ª + + é,è,ë,ê,ę,ė,ē + + í,ï,ì,î,į,ī + + ó,ò,ö,ô,õ,ø,œ,ō,º + + ú,ü,ù,û,ū + + ñ,ń + + ç,ć,č + + ñ + + "!fixedColumnOrder!9,¡,\",\',#,-,:,!,\\,,\?,¿,\@,&,\\%,+,;,/,(,)" + + "!,¡" + + "\?,¿" + \" + \' + \' + diff --git a/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml new file mode 100644 index 000000000..d037044bd --- /dev/null +++ b/tools/make-keyboard-text/res/values-et/donottranslate-more-keys.xml @@ -0,0 +1,116 @@ + + + + + ä,ā,à,á,â,ã,å,æ,ą + + ē,è,ė,é,ê,ë,ę,ě + + ī,ì,į,í,î,ï,ı + + ö,õ,ò,ó,ô,œ,ő,ø + + ü,ū,ų,ù,ú,û,ů,ű + + š,ß,ś,ş + + ņ,ñ,ń,ń + + č,ç,ć + + ý,ÿ + + ď + + ŗ,ř,ŕ + + ţ,ť + + ž,ż,ź + + ķ + + ļ,ł,ĺ,ľ + + ģ,ğ + + ü + + ö + + ä + + õ + !text/single_9qm_lqm + !text/double_9qm_lqm + 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 new file mode 100644 index 000000000..6d13d6bb6 --- /dev/null +++ b/tools/make-keyboard-text/res/values-fa/donottranslate-more-keys.xml @@ -0,0 +1,132 @@ + + + + + ا‌ب‌پ + + ۱ + + ۲ + + ۳ + + ۴ + + ۵ + + ۶ + + ۷ + + ۸ + + ۹ + + ۰ + + ۳۲۱؟ + + ۳۲۱ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + 0,٫,٬ + + ، + "\\," + ؟ + ؛ + + ٪ + \? + ; + + \\%,‰ + + "،" + "!" + "!,\\," + "؟" + "؟,\?" + ، + ؟ + "!fixedColumnOrder!4,:,!,؟,؛,-,/,«|»,»|«" + + "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|(" + + + + ★,٭ + + + !fixedColumnOrder!4,﴾|﴿,<|>,{|},[|] + !fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[ + + !fixedColumnOrder!3,‹|›,≤|≥,<|> + !fixedColumnOrder!3,›|‹,≥|≤,>|< + !text/single_laqm_raqm_rtl + !text/double_laqm_raqm_rtl + + + + + "!fixedColumnOrder!7, ٕ|ٕ, ْ|ْ, ّ|ّ, ٌ|ٌ, ٍ|ٍ, ً|ً, ٔ|ٔ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ُ|ُ, ِ|ِ, َ|َ,ـــ|ـ" + ً + diff --git a/tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml new file mode 100644 index 000000000..25b785845 --- /dev/null +++ b/tools/make-keyboard-text/res/values-fi/donottranslate-more-keys.xml @@ -0,0 +1,56 @@ + + + + + æ,à,á,â,ã,ā + + ø,ô,ò,ó,õ,œ,ō + + ü + + š,ß,ś + + ž,ź,ż + + å + + ö + + ä + + ø + + æ + 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 new file mode 100644 index 000000000..7b11a183d --- /dev/null +++ b/tools/make-keyboard-text/res/values-fr/donottranslate-more-keys.xml @@ -0,0 +1,68 @@ + + + + + à,â,%,æ,á,ä,ã,å,ā,ª + + é,è,ê,ë,%,ę,ė,ē + + î,%,ï,ì,í,į,ī + + ô,œ,%,ö,ò,ó,õ,ø,ō,º + + ù,û,%,ü,ú,ū + + ç,ć,č + + %,ÿ + 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 new file mode 100644 index 000000000..98ad2cb3e --- /dev/null +++ b/tools/make-keyboard-text/res/values-hi/donottranslate-more-keys.xml @@ -0,0 +1,63 @@ + + + + + कखग + + + + + + + + + + + + + + + + + + + + + + \?१२३ + + १२३ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + + diff --git a/tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml new file mode 100644 index 000000000..022bd2a87 --- /dev/null +++ b/tools/make-keyboard-text/res/values-hr/donottranslate-more-keys.xml @@ -0,0 +1,42 @@ + + + + + š,ś,ß + + ñ,ń + + ž,ź,ż + + č,ć,ç + + đ + !text/single_9qm_rqm + !text/double_9qm_rqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml new file mode 100644 index 000000000..ce2f5d057 --- /dev/null +++ b/tools/make-keyboard-text/res/values-hu/donottranslate-more-keys.xml @@ -0,0 +1,66 @@ + + + + + á,à,â,ä,æ,ã,å,ā + + é,è,ê,ë,ę,ė,ē + + í,î,ï,ì,į,ī + + ó,ö,ő,ô,ò,õ,œ,ø,ō + + ú,ü,ű,û,ù,ū + !text/single_9qm_rqm + !text/double_9qm_rqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml new file mode 100644 index 000000000..4b4d986b8 --- /dev/null +++ b/tools/make-keyboard-text/res/values-is/donottranslate-more-keys.xml @@ -0,0 +1,75 @@ + + + + + á,ä,æ,å,à,â,ã,ā + + é,ë,è,ê,ę,ė,ē + + í,ï,î,ì,į,ī + + ó,ö,ô,ò,õ,œ,ø,ō + + ú,ü,û,ù,ū + + ý,ÿ + + ð + + þ + + ð + + æ + + þ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml new file mode 100644 index 000000000..17dd03108 --- /dev/null +++ b/tools/make-keyboard-text/res/values-it/donottranslate-more-keys.xml @@ -0,0 +1,62 @@ + + + + + à,á,â,ä,æ,ã,å,ā,ª + + è,é,ê,ë,ę,ė,ē + + ì,í,î,ï,į,ī + + ò,ó,ô,ö,õ,œ,ø,ō,º + + ù,ú,û,ü,ū + 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 new file mode 100644 index 000000000..9d2e01ebd --- /dev/null +++ b/tools/make-keyboard-text/res/values-iw/donottranslate-more-keys.xml @@ -0,0 +1,55 @@ + + + + + אבג + "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(|),)|(" + + + + ±,﬩ + + !fixedColumnOrder!3,<|>,{|},[|] + !fixedColumnOrder!3,>|<,}|{,]|[ + + !fixedColumnOrder!3,‹|›,≤|≥,«|» + !fixedColumnOrder!3,›|‹,≥|≤,»|« + + ‘,’,‚ + “,”,„ + !text/single_laqm_raqm_rtl + !text/double_laqm_raqm_rtl + diff --git a/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml new file mode 100644 index 000000000..8c2add44c --- /dev/null +++ b/tools/make-keyboard-text/res/values-ka/donottranslate-more-keys.xml @@ -0,0 +1,28 @@ + + + + + აბგ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml new file mode 100644 index 000000000..0e953ff21 --- /dev/null +++ b/tools/make-keyboard-text/res/values-kk/donottranslate-more-keys.xml @@ -0,0 +1,57 @@ + + + + + щ + + ъ + + ы + + э + + и + + ү,ұ + + қ + + ё + + ң + + ғ + + і + + ә + + ө + + һ + + ъ + + АБВ + diff --git a/tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml new file mode 100644 index 000000000..8d8c5fbf2 --- /dev/null +++ b/tools/make-keyboard-text/res/values-ky/donottranslate-more-keys.xml @@ -0,0 +1,46 @@ + + + + + щ + + ъ + + ы + + э + + и + + ү + + ё + + ң + + ө + + ъ + + АБВ + diff --git a/tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml new file mode 100644 index 000000000..7e2b8a076 --- /dev/null +++ b/tools/make-keyboard-text/res/values-lt/donottranslate-more-keys.xml @@ -0,0 +1,109 @@ + + + + + ą,ä,ā,à,á,â,ã,å,æ + + ė,ę,ē,è,é,ê,ë,ě + + į,ī,ì,í,î,ï,ı + + ö,õ,ò,ó,ô,œ,ő,ø + + ū,ų,ü,ū,ù,ú,û,ů,ű + + š,ß,ś,ş + + ņ,ñ,ń,ń + + č,ç,ć + + ý,ÿ + + ď + + ŗ,ř,ŕ + + ţ,ť + + ž,ż,ź + + ķ + + ļ,ł,ĺ,ľ + + ģ,ğ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml new file mode 100644 index 000000000..c64e37bc8 --- /dev/null +++ b/tools/make-keyboard-text/res/values-lv/donottranslate-more-keys.xml @@ -0,0 +1,108 @@ + + + + + ā,à,á,â,ã,ä,å,æ,ą + + ē,ė,è,é,ê,ë,ę,ě + + ī,į,ì,í,î,ï,ı + + ò,ó,ô,õ,ö,œ,ő,ø + + ū,ų,ù,ú,û,ü,ů,ű + + š,ß,ś,ş + + ņ,ñ,ń,ń + + č,ç,ć + + ý,ÿ + + ď + + ŗ,ř,ŕ + + ţ,ť + + ž,ż,ź + + ķ + + ļ,ł,ĺ,ľ + + ģ,ğ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml new file mode 100644 index 000000000..2db75c8f5 --- /dev/null +++ b/tools/make-keyboard-text/res/values-mk/donottranslate-more-keys.xml @@ -0,0 +1,40 @@ + + + + + ѕ + + ќ + + з + + ѓ + + ѐ + + ѝ + + АБВ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml new file mode 100644 index 000000000..fd1853e85 --- /dev/null +++ b/tools/make-keyboard-text/res/values-mn/donottranslate-more-keys.xml @@ -0,0 +1,28 @@ + + + + + АБВ + + + diff --git a/tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml new file mode 100644 index 000000000..2cecb5e65 --- /dev/null +++ b/tools/make-keyboard-text/res/values-nb/donottranslate-more-keys.xml @@ -0,0 +1,62 @@ + + + + + à,ä,á,â,ã,ā + + é,è,ê,ë,ę,ė,ē + + ô,ò,ó,ö,õ,œ,ō + + ü,û,ù,ú,ū + + å + + ø + + æ + + ö + + ä + !text/single_9qm_rqm + !text/double_9qm_rqm + diff --git a/tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml new file mode 100644 index 000000000..e5d82951a --- /dev/null +++ b/tools/make-keyboard-text/res/values-nl/donottranslate-more-keys.xml @@ -0,0 +1,68 @@ + + + + + á,ä,â,à,æ,ã,å,ā + + é,ë,ê,è,ę,ė,ē + + í,ï,ì,î,į,ī,ij + + ó,ö,ô,ò,õ,œ,ø,ō + + ú,ü,û,ù,ū + + ñ,ń + + ij + !text/single_9qm_rqm + !text/double_9qm_rqm + diff --git a/tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml new file mode 100644 index 000000000..b5cf6a0fa --- /dev/null +++ b/tools/make-keyboard-text/res/values-pl/donottranslate-more-keys.xml @@ -0,0 +1,67 @@ + + + + + ą,á,à,â,ä,æ,ã,å,ā + + ę,è,é,ê,ë,ė,ē + + ó,ö,ô,ò,õ,œ,ø,ō + + ś,ß,š + + ń,ñ + + ć,ç,č + + ż,ź,ž + + ł + !text/single_9qm_rqm + !text/double_9qm_rqm + diff --git a/tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml new file mode 100644 index 000000000..0c9065f27 --- /dev/null +++ b/tools/make-keyboard-text/res/values-pt/donottranslate-more-keys.xml @@ -0,0 +1,65 @@ + + + + + á,ã,à,â,ä,å,æ,ª + + é,ê,è,ę,ė,ē,ë + + í,î,ì,ï,į,ī + + ó,õ,ô,ò,ö,œ,ø,ō,º + + ú,ü,ù,û,ū + + ç,č,ć + diff --git a/tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml new file mode 100644 index 000000000..aa0d7f817 --- /dev/null +++ b/tools/make-keyboard-text/res/values-rm/donottranslate-more-keys.xml @@ -0,0 +1,29 @@ + + + + + ò,ó,ö,ô,õ,œ,ø + diff --git a/tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml new file mode 100644 index 000000000..f399eb28e --- /dev/null +++ b/tools/make-keyboard-text/res/values-ro/donottranslate-more-keys.xml @@ -0,0 +1,47 @@ + + + + + â,ã,ă,à,á,ä,æ,å,ā + + î,ï,ì,í,į,ī + + ș,ß,ś,š + + ț + !text/single_9qm_rqm + !text/double_9qm_rqm + diff --git a/tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml new file mode 100644 index 000000000..f62c90ffc --- /dev/null +++ b/tools/make-keyboard-text/res/values-ru/donottranslate-more-keys.xml @@ -0,0 +1,42 @@ + + + + + щ + + ъ + + ы + + э + + и + + ё + + ъ + + АБВ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml new file mode 100644 index 000000000..2ed538e5b --- /dev/null +++ b/tools/make-keyboard-text/res/values-sk/donottranslate-more-keys.xml @@ -0,0 +1,111 @@ + + + + + á,ä,ā,à,â,ã,å,æ,ą + + é,ě,ē,ė,è,ê,ë,ę + + í,ī,į,ì,î,ï,ı + + ô,ó,ö,ò,õ,œ,ő,ø + + ú,ů,ü,ū,ų,ù,û,ű + + š,ß,ś,ş + + ň,ņ,ñ,ń,ń + + č,ç,ć + + ý,ÿ + + ď + + ŕ,ř,ŗ + + ť,ţ + + ž,ż,ź + + ķ + + ľ,ĺ,ļ,ł + + ģ,ğ + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml new file mode 100644 index 000000000..1e5d1d71f --- /dev/null +++ b/tools/make-keyboard-text/res/values-sl/donottranslate-more-keys.xml @@ -0,0 +1,34 @@ + + + + + š + + č,ć + + đ + + ž + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml new file mode 100644 index 000000000..c00d2a665 --- /dev/null +++ b/tools/make-keyboard-text/res/values-sr/donottranslate-more-keys.xml @@ -0,0 +1,61 @@ + + + + + + + з + + ћ + + ѕ + + ђ + + ѐ + + ѝ + + + АБВ + !text/single_9qm_lqm + !text/double_9qm_lqm + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml new file mode 100644 index 000000000..a36a13eb2 --- /dev/null +++ b/tools/make-keyboard-text/res/values-sv/donottranslate-more-keys.xml @@ -0,0 +1,56 @@ + + + + + é,è,ê,ë,ę + + œ,ô,ò,ó,õ,ō + + ü,û,ù,ú,ū + + ß,ś,š + + å + + ö + + ä + + ø + + æ + !text/single_raqm_laqm + !text/double_raqm_laqm + diff --git a/tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml new file mode 100644 index 000000000..968a80c1c --- /dev/null +++ b/tools/make-keyboard-text/res/values-sw/donottranslate-more-keys.xml @@ -0,0 +1,65 @@ + + + + + + à,á,â,ä,æ,ã,å,ā + + è,é,ê,ë,ē + + î,ï,í,ī,ì + + ô,ö,ò,ó,œ,ø,ō,õ + + û,ü,ù,ú,ū + + ß + + ñ + + ç + g\' + diff --git a/tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml new file mode 100644 index 000000000..6350d4b8e --- /dev/null +++ b/tools/make-keyboard-text/res/values-th/donottranslate-more-keys.xml @@ -0,0 +1,28 @@ + + + + + กขค + + ฿ + diff --git a/tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml new file mode 100644 index 000000000..383d55ccf --- /dev/null +++ b/tools/make-keyboard-text/res/values-tl/donottranslate-more-keys.xml @@ -0,0 +1,70 @@ + + + + + á,à,ä,â,ã,å,ą,æ,ā,ª + + é,è,ë,ê,ę,ė,ē + + í,ï,ì,î,į,ī + + ó,ò,ö,ô,õ,ø,œ,ō,º + + ú,ü,ù,û,ū + + ñ,ń + + ç,ć,č + diff --git a/tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml new file mode 100644 index 000000000..1161811d4 --- /dev/null +++ b/tools/make-keyboard-text/res/values-tr/donottranslate-more-keys.xml @@ -0,0 +1,57 @@ + + + + + â + + ı,î,ï,ì,í,į,ī + + ö,ô,œ,ò,ó,õ,ø,ō + + ü,û,ù,ú,ū + + ş,ß,ś,š + + ğ + + ç,ć,č + diff --git a/tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml new file mode 100644 index 000000000..cc05cc697 --- /dev/null +++ b/tools/make-keyboard-text/res/values-uk/donottranslate-more-keys.xml @@ -0,0 +1,46 @@ + + + + + щ + + ї + + і + + є + + и + + ґ + + ї + + ъ + + + + АБВ + !text/single_9qm_lqm + !text/double_9qm_lqm + diff --git a/tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml new file mode 100644 index 000000000..fa98ea9e1 --- /dev/null +++ b/tools/make-keyboard-text/res/values-vi/donottranslate-more-keys.xml @@ -0,0 +1,97 @@ + + + + + à,á,ả,ã,ạ,ă,ằ,ắ,ẳ,ẵ,ặ,â,ầ,ấ,ẩ,ẫ,ậ + + è,é,ẻ,ẽ,ẹ,ê,ề,ế,ể,ễ,ệ + + ì,í,ỉ,ĩ,ị + + ò,ó,ỏ,õ,ọ,ô,ồ,ố,ổ,ỗ,ộ,ơ,ờ,ớ,ở,ỡ,ợ + + ù,ú,ủ,ũ,ụ,ư,ừ,ứ,ử,ữ,ự + + ỳ,ý,ỷ,ỹ,ỵ + + đ + + + diff --git a/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml new file mode 100644 index 000000000..191791530 --- /dev/null +++ b/tools/make-keyboard-text/res/values-zu/donottranslate-more-keys.xml @@ -0,0 +1,64 @@ + + + + + + à,á,â,ä,æ,ã,å,ā + + è,é,ê,ë,ē + + î,ï,í,ī,ì + + ô,ö,ò,ó,œ,ø,ō,õ + + û,ü,ù,ú,ū + + ß + + ñ + + ç + diff --git a/tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml new file mode 100644 index 000000000..eb984a469 --- /dev/null +++ b/tools/make-keyboard-text/res/values-zz/donottranslate-more-keys.xml @@ -0,0 +1,139 @@ + + + + + à,á,â,ã,ä,å,æ,ã,å,ā,ă,ą,ª + + è,é,ê,ë,ē,ĕ,ė,ę,ě + + ì,í,î,ï,ĩ,ī,ĭ,į,ı,ij + + ò,ó,ô,õ,ö,ø,ō,ŏ,ő,œ,º + + ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų + + ß,ś,ŝ,ş,š,ſ + + ñ,ń,ņ,ň,ʼn,ŋ + + ç,ć,ĉ,ċ,č + + ý,ŷ,ÿ,ij + + ď,đ,ð + + ŕ,ŗ,ř + + þ,ţ,ť,ŧ + + ź,ż,ž + + ķ,ĸ + + ĺ,ļ,ľ,ŀ,ł + + ĝ,ğ,ġ,ģ + + ĥ + + ĵ + + ŵ + diff --git a/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml new file mode 100644 index 000000000..4cf26505f --- /dev/null +++ b/tools/make-keyboard-text/res/values/donottranslate-more-keys.xml @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ABC + !text/single_lqm_rqm + !text/double_lqm_rqm + !text/single_laqm_raqm + !text/double_laqm_raqm + + ¢,£,€,¥,₱ + $ + $,¢,€,£,¥,₱ + "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(,)" + + †,‡,★ + + ♪,♥,♠,♦,♣ + + ± + + !fixedColumnOrder!3,<,{,[ + !fixedColumnOrder!3,>,},] + + !fixedColumnOrder!3,‹,≤,« + !fixedColumnOrder!3,›,≥,» + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + + \?123 + + 123 + + + + + + + + + + + + ¹,½,⅓,¼,⅛ + + ²,⅔ + + ³,¾,⅜ + + + + + + + + + + + ⁿ,∅ + , + + \? + ; + % + + ¡ + + ¿ + + + + , + ! + ! + \? + \? + \' + \" + \" + + + q + w + y + x + + !fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm + !icon/settings_key|!code/key_settings + !icon/shortcut_key|!code/key_shortcut + !hasLabels!,\@string/label_next_key|!code/key_action_next + !hasLabels!,\@string/label_previous_key|!code/key_action_previous + + = \\ < + + ~ \\ { + + Tab + + 123 + + + *# + + "AM" + + "PM" + + Sym + ".com" + + "!hasLabels!,.net,.org,.gov,.edu" + "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ " + + + + ‹,› + ‹|›,›|‹ + ›,‹ + «,» + «|»,»|« + »,« + + ‚,‘,’ + ’,‚,‘ + ‘,‚,’ + „,“,” + ”,„,“ + “,„,” + !fixedColumnOrder!5,!text/single_quotes,!text/single_angle_quotes + !fixedColumnOrder!5,!text/double_quotes,!text/double_angle_quotes + !fixedColumnOrder!6,!text/double_quotes,!text/single_quotes,!text/double_angle_quotes,!text/single_angle_quotes + 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 new file mode 100644 index 000000000..331003e67 --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/ArrayInitializerFormatter.java @@ -0,0 +1,89 @@ +/* + * 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.tools; + +import java.io.PrintStream; + +public class ArrayInitializerFormatter { + private final PrintStream mOut; + private final int mMaxWidth; + private final String mIndent; + + private int mCurrentIndex = 0; + private String mFixedElement; + private final StringBuilder mBuffer = new StringBuilder(); + private int mBufferedLen; + private int mBufferedIndex = Integer.MIN_VALUE; + + public ArrayInitializerFormatter(PrintStream out, int width, String indent) { + mOut = out; + mMaxWidth = width - indent.length(); + mIndent = indent; + } + + public void flush() { + if (mBuffer.length() == 0) { + 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]); + } else { + mOut.format("%s/* %d~ */\n" + + "%s%s\n" + + "%s/* ~%d */\n", mIndent, mBufferedIndex, + mIndent, mBuffer, + mIndent, lastIndex); + } + mBuffer.setLength(0); + mBufferedLen = 0; + } + + public void outCommentLines(String lines) { + flush(); + mOut.print(lines); + mFixedElement = null; + } + + public void outElement(String element) { + if (!element.equals(mFixedElement)) { + flush(); + mBufferedIndex = mCurrentIndex; + } + final int nextLen = mBufferedLen + " ".length() + element.length(); + if (mBufferedLen != 0 && nextLen < mMaxWidth) { + mBuffer.append(' '); + mBuffer.append(element); + mBufferedLen = nextLen; + } else { + if (mBufferedLen != 0) { + mBuffer.append('\n'); + mBuffer.append(mIndent); + } + mBuffer.append(element); + mBufferedLen = element.length(); + } + mCurrentIndex++; + mFixedElement = element; + } +} diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java new file mode 100644 index 000000000..a74096e79 --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/JarUtils.java @@ -0,0 +1,85 @@ +/* + * 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.tools; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public final class JarUtils { + private JarUtils() { + // This utility class is not publicly instantiable. + } + + public static JarFile getJarFile(final Class mainClass) { + final String mainClassPath = "/" + mainClass.getName().replace('.', '/') + ".class"; + final URL resUrl = mainClass.getResource(mainClassPath); + if (!resUrl.getProtocol().equals("jar")) { + throw new RuntimeException("Should run as jar"); + } + final String path = resUrl.getPath(); + if (!path.startsWith("file:")) { + throw new RuntimeException("Unknown jar path: " + path); + } + final String jarPath = path.substring("file:".length(), path.indexOf('!')); + try { + return new JarFile(URLDecoder.decode(jarPath, "UTF-8")); + } catch (UnsupportedEncodingException e) { + } catch (IOException e) { + } + return null; + } + + public static InputStream openResource(final String name) { + return JarUtils.class.getResourceAsStream("/" + name); + } + + public interface JarFilter { + public boolean accept(String dirName, String name); + } + + public static ArrayList getNameListing(final JarFile jar, final JarFilter filter) { + final ArrayList result = new ArrayList(); + final Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + final JarEntry entry = entries.nextElement(); + final String path = entry.getName(); + final int pos = path.lastIndexOf('/'); + final String dirName = (pos >= 0) ? path.substring(0, pos) : ""; + final String name = (pos >= 0) ? path.substring(pos + 1) : path; + if (filter.accept(dirName, name)) { + result.add(path); + } + } + return result; + } + + public static ArrayList getNameListing(final JarFile jar, final String filterName) { + return getNameListing(jar, new JarFilter() { + @Override + public boolean accept(final String dirName, final String name) { + return name.equals(filterName); + } + }); + } +} diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java new file mode 100644 index 000000000..36a03f8dc --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MakeKeyboardText.java @@ -0,0 +1,65 @@ +/* + * 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.tools; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.NoSuchElementException; +import java.util.jar.JarFile; + +public class MakeKeyboardText { + static class Options { + private static final String OPTION_JAVA = "-java"; + + public final String mJava; + + public static void usage(String message) { + if (message != null) { + System.err.println(message); + } + System.err.println("usage: make-keyboard-text " + OPTION_JAVA + " "); + System.exit(1); + } + + public Options(final String[] argsArray) { + final LinkedList args = new LinkedList(Arrays.asList(argsArray)); + String arg = null; + String java = null; + try { + while (!args.isEmpty()) { + arg = args.removeFirst(); + if (arg.equals(OPTION_JAVA)) { + java = args.removeFirst(); + } else { + usage("Unknown option: " + arg); + } + } + } catch (NoSuchElementException e) { + usage("Option " + arg + " needs argument"); + } + + mJava = java; + } + } + + public static void main(final String[] args) { + final Options options = new Options(args); + final JarFile jar = JarUtils.getJarFile(MakeKeyboardText.class); + final MoreKeysResources resources = new MoreKeysResources(jar); + resources.writeToJava(options.mJava); + } +} 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 new file mode 100644 index 000000000..2643e01ec --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/MoreKeysResources.java @@ -0,0 +1,264 @@ +/* + * 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.tools; + +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.LineNumberReader; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Locale; +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 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 EMPTY_STRING_VAR = "EMPTY"; + + private static final String NO_LANGUAGE_CODE = "zz"; + private static final String NO_LANGUAGE_DISPLAY_NAME = "Alphabet"; + + private final JarFile mJar; + // Language to string resources map. + private final HashMap mResourcesMap = + new HashMap(); + // Name to id map. + private final HashMap mNameToIdMap = new HashMap(); + + public MoreKeysResources(final JarFile jar) { + mJar = jar; + final ArrayList resources = JarUtils.getNameListing(jar, TEXT_RESOURCE_NAME); + for (final String name : resources) { + final String dirName = name.substring(0, name.lastIndexOf('/')); + final int pos = dirName.lastIndexOf('/'); + final String parentName = (pos >= 0) ? dirName.substring(pos + 1) : dirName; + final String language = getLanguageFromResDir(parentName); + final InputStream stream = JarUtils.openResource(name); + try { + mResourcesMap.put(language, new StringResourceMap(stream)); + } finally { + close(stream); + } + } + } + + private static String getLanguageFromResDir(final String dirName) { + final int languagePos = dirName.indexOf('-'); + if (languagePos < 0) { + // Default resource. + return DEFAUT_LANGUAGE_NAME; + } + final String language = dirName.substring(languagePos + 1); + final int countryPos = language.indexOf("-r"); + if (countryPos < 0) { + return language; + } + return language.replace("-r", "_"); + } + + public void writeToJava(final String outDir) { + final ArrayList list = JarUtils.getNameListing(mJar, JAVA_TEMPLATE); + if (list.isEmpty()) + throw new RuntimeException("Can't find java template " + JAVA_TEMPLATE); + 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; + LineNumberReader lnr = null; + try { + if (outDir == null) { + ps = System.out; + } else { + final File outPackage = new File(outDir, javaPackage); + final File outputFile = new File(outPackage, + JAVA_TEMPLATE.replace(".tmpl", ".java")); + outPackage.mkdirs(); + ps = new PrintStream(outputFile, "UTF-8"); + } + lnr = new LineNumberReader(new InputStreamReader(JarUtils.openResource(template))); + inflateTemplate(lnr, ps); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + close(lnr); + close(ps); + } + } + + private void inflateTemplate(final LineNumberReader in, final PrintStream out) + throws IOException { + String line; + while ((line = in.readLine()) != null) { + if (line.contains(MARK_NAMES)) { + dumpNames(out); + } else if (line.contains(MARK_DEFAULT_TEXTS)) { + dumpDefaultTexts(out); + } else if (line.contains(MARK_TEXTS)) { + dumpTexts(out); + } else if (line.contains(MARK_LANGUAGES_AND_TEXTS)) { + dumpLanguageMap(out); + } else { + out.println(line); + } + } + } + + 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++; + } + } + + private void dumpDefaultTexts(final PrintStream out) { + final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); + dumpTextsInternal(out, defaultResMap, defaultResMap); + } + + private void dumpTexts(final PrintStream out) { + final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); + final ArrayList allLanguages = new ArrayList(); + 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); + 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); + out.format(" };\n\n"); + } + } + + private void dumpLanguageMap(final PrintStream out) { + final ArrayList allLanguages = new ArrayList(); + 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)); + } + } + + private static String getLanguageDisplayName(final String language) { + if (language.equals(NO_LANGUAGE_CODE)) { + return NO_LANGUAGE_DISPLAY_NAME; + } else { + return new Locale(language).getDisplayLanguage(); + } + } + + private static void dumpTextsInternal(final PrintStream out, final StringResourceMap resMap, + final StringResourceMap defaultResMap) { + final ArrayInitializerFormatter formatter = + new ArrayInitializerFormatter(out, 100, " "); + boolean successiveNull = false; + for (final StringResource defaultRes : defaultResMap.getResources()) { + if (resMap.contains(defaultRes.mName)) { + final StringResource res = resMap.get(defaultRes.mName); + if (res.mComment != null) { + formatter.outCommentLines(addPrefix(" // ", res. mComment)); + } + final String escaped = escapeNonAscii(res.mValue); + if (escaped.length() == 0) { + formatter.outElement(EMPTY_STRING_VAR + ","); + } else { + formatter.outElement(String.format("\"%s\",", escaped)); + } + successiveNull = false; + } else { + formatter.outElement("null,"); + successiveNull = true; + } + } + if (!successiveNull) { + formatter.flush(); + } + } + + private static String addPrefix(final String prefix, final String lines) { + final StringBuilder sb = new StringBuilder(); + for (final String line : lines.split("\n")) { + sb.append(prefix + line.trim() + "\n"); + } + return sb.toString(); + } + + private static String escapeNonAscii(final String text) { + final StringBuilder sb = new StringBuilder(); + final int length = text.length(); + for (int i = 0; i < length; i++) { + final char c = text.charAt(i); + if (c >= ' ' && c < 0x7f) { + sb.append(c); + } else { + 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; + } + + private static void close(Closeable stream) { + try { + if (stream != null) { + stream.close(); + } + } catch (IOException e) { + } + } +} diff --git a/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java new file mode 100644 index 000000000..a49b8fe70 --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResource.java @@ -0,0 +1,29 @@ +/* + * 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.tools; + +public class StringResource { + public final String mName; + public final String mValue; + public final String mComment; + + public StringResource(final String name, final String value, final String comment) { + mName = name; + mValue = value; + mComment = comment; + } +} 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 new file mode 100644 index 000000000..cc7ff6a9c --- /dev/null +++ b/tools/make-keyboard-text/src/com/android/inputmethod/keyboard/tools/StringResourceMap.java @@ -0,0 +1,135 @@ +/* + * 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.tools; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.ext.DefaultHandler2; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +public class StringResourceMap { + // String resource list. + private final List mResources; + // Name to string resource map. + private final Map mResourcesMap; + + public StringResourceMap(final InputStream is) { + final StringResourceHandler handler = new StringResourceHandler(); + final SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + try { + final SAXParser parser = factory.newSAXParser(); + // In order to get comment tag. + parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler); + parser.parse(is, handler); + } catch (ParserConfigurationException e) { + } catch (SAXParseException e) { + throw new RuntimeException(e.getMessage() + " at line " + e.getLineNumber() + + ", column " + e.getColumnNumber()); + } catch (SAXException e) { + throw new RuntimeException(e.getMessage()); + } catch (IOException e) { + } + + mResources = Collections.unmodifiableList(handler.mResources); + final HashMap map = new HashMap(); + for (final StringResource res : mResources) { + map.put(res.mName, res); + } + mResourcesMap = map; + } + + public List getResources() { + return mResources; + } + + public boolean contains(final String name) { + return mResourcesMap.containsKey(name); + } + + public StringResource get(final String name) { + return mResourcesMap.get(name); + } + + static class StringResourceHandler extends DefaultHandler2 { + private static final String TAG_RESOURCES = "resources"; + private static final String TAG_STRING = "string"; + private static final String ATTR_NAME = "name"; + + final ArrayList mResources = new ArrayList(); + + private String mName; + private final StringBuilder mValue = new StringBuilder(); + private final StringBuilder mComment = new StringBuilder(); + + private void init() { + mName = null; + mComment.setLength(0); + } + + @Override + public void comment(char[] ch, int start, int length) { + mComment.append(ch, start, length); + if (ch[start + length - 1] != '\n') { + mComment.append('\n'); + } + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes attr) { + if (TAG_RESOURCES.equals(localName)) { + init(); + } else if (TAG_STRING.equals(localName)) { + mName = attr.getValue(ATTR_NAME); + mValue.setLength(0); + } + } + + @Override + public void characters(char[] ch, int start, int length) { + mValue.append(ch, start, length); + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (TAG_STRING.equals(localName)) { + if (mName == null) + throw new SAXException(TAG_STRING + " doesn't have name"); + final String comment = mComment.length() > 0 ? mComment.toString() : null; + String value = mValue.toString(); + if (value.startsWith("\"") && value.endsWith("\"")) { + // Trim surroundings double quote. + value = value.substring(1, value.length() - 1); + } + mResources.add(new StringResource(mName, value, comment)); + init(); + } + } + } +} diff --git a/tools/maketext/Android.mk b/tools/maketext/Android.mk deleted file mode 100644 index 77914cae6..000000000 --- a/tools/maketext/Android.mk +++ /dev/null @@ -1,25 +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. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES += $(call all-java-files-under,src) -LOCAL_JAR_MANIFEST := etc/manifest.txt -LOCAL_JAVA_RESOURCE_DIRS := res -LOCAL_MODULE := maketext - -include $(BUILD_HOST_JAVA_LIBRARY) -include $(LOCAL_PATH)/etc/Android.mk diff --git a/tools/maketext/etc/Android.mk b/tools/maketext/etc/Android.mk deleted file mode 100644 index 475676b3a..000000000 --- a/tools/maketext/etc/Android.mk +++ /dev/null @@ -1,20 +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. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PREBUILT_EXECUTABLES := maketext - -include $(BUILD_HOST_PREBUILT) diff --git a/tools/maketext/etc/maketext b/tools/maketext/etc/maketext deleted file mode 100755 index 0edd36020..000000000 --- a/tools/maketext/etc/maketext +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# Copyright 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. - -# Set up prog to be the path of this script, including following symlinks, -# and set up progdir to be the fully-qualified pathname of its directory. -prog="$0" -while [ -h "${prog}" ]; do - newProg=`/bin/ls -ld "${prog}"` - newProg=`expr "${newProg}" : ".* -> \(.*\)$"` - if expr "x${newProg}" : 'x/' >/dev/null; then - prog="${newProg}" - else - progdir=`dirname "${prog}"` - prog="${progdir}/${newProg}" - fi -done -oldwd=`pwd` -progdir=`dirname "${prog}"` -cd "${progdir}" -progdir=`pwd` -prog="${progdir}"/`basename "${prog}"` -cd "${oldwd}" - -jarfile=maketext.jar -frameworkdir="$progdir" -if [ ! -r "$frameworkdir/$jarfile" ] -then - frameworkdir=`dirname "$progdir"`/tools/lib - libdir=`dirname "$progdir"`/tools/lib -fi -if [ ! -r "$frameworkdir/$jarfile" ] -then - frameworkdir=`dirname "$progdir"`/framework - libdir=`dirname "$progdir"`/lib -fi -if [ ! -r "$frameworkdir/$jarfile" ] -then - echo `basename "$prog"`": can't find $jarfile" - exit 1 -fi - -if [ "$OSTYPE" = "cygwin" ] ; then - jarpath=`cygpath -w "$frameworkdir/$jarfile"` - progdir=`cygpath -w "$progdir"` -else - jarpath="$frameworkdir/$jarfile" -fi - -# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored -# might need more memory, e.g. -Xmx128M -exec java -ea -jar "$jarpath" "$@" diff --git a/tools/maketext/etc/manifest.txt b/tools/maketext/etc/manifest.txt deleted file mode 100644 index bfd1a52be..000000000 --- a/tools/maketext/etc/manifest.txt +++ /dev/null @@ -1 +0,0 @@ -Main-Class: com.android.inputmethod.latin.maketext.LabelText diff --git a/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl b/tools/maketext/res/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.tmpl deleted file mode 100644 index 479a766fb..000000000 --- a/tools/maketext/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/maketext. The base template file is - * tools/maketext/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/" in keyboard XML definitions, - * and should be defined in - * tools/maketext/res/values-/donottranslate-more-keys.xml - * - * To update this file, please run the following commands. - * $ cd $ANDROID_BUILD_TOP - * $ mmm packages/inputmethods/LatinIME/tools/maketext - * $ maketext -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 sLocaleToTextsMap = CollectionUtils.newHashMap(); - private static final HashMap sNameToIdsMap = CollectionUtils.newHashMap(); - - private String[] mTexts; - // Resource name to text map. - private HashMap 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/ 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/maketext/res/values-af/donottranslate-more-keys.xml b/tools/maketext/res/values-af/donottranslate-more-keys.xml deleted file mode 100644 index ee96f442d..000000000 --- a/tools/maketext/res/values-af/donottranslate-more-keys.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - á,â,ä,à,æ,ã,å,ā - - é,è,ê,ë,ę,ė,ē - - í,ì,ï,î,į,ī,ij - - ó,ô,ö,ò,õ,œ,ø,ō - - ú,û,ü,ù,ū - - ñ,ń - ý,ŷ,ÿ,ij - - ý,ij - diff --git a/tools/maketext/res/values-ar/donottranslate-more-keys.xml b/tools/maketext/res/values-ar/donottranslate-more-keys.xml deleted file mode 100644 index 8b86b1ba2..000000000 --- a/tools/maketext/res/values-ar/donottranslate-more-keys.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - أ‌ب‌ج - - ١ - - ٢ - - ٣ - - ٤ - - ٥ - - ٦ - - ٧ - - ٨ - - ٩ - - ٠ - - ٣٢١؟ - - ٣٢١ - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - - 0,٫,٬ - - ، - "\\," - ؟ - ؛ - - ٪ - \? - ; - - \\%,‰ - - ، - ؟ - - "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|(" - "؟,؛,!,:,-,/,\',\"" - - - - ★,٭ - - - !fixedColumnOrder!4,﴾|﴿,<|>,{|},[|] - !fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[ - - !fixedColumnOrder!3,‹|›,≤|≥,«|» - !fixedColumnOrder!3,›|‹,≥|≤,»|« - !text/single_laqm_raqm_rtl - !text/double_laqm_raqm_rtl - - - - - "!fixedColumnOrder!7, ٕ|ٕ, ٔ|ٔ, ْ|ْ, ٍ|ٍ, ٌ|ٌ, ً|ً, ّ|ّ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ِ|ِ, ُ|ُ, َ|َ,ـــ|ـ" - ّ - diff --git a/tools/maketext/res/values-az/donottranslate-more-keys.xml b/tools/maketext/res/values-az/donottranslate-more-keys.xml deleted file mode 100644 index db1784c17..000000000 --- a/tools/maketext/res/values-az/donottranslate-more-keys.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - â - - ə - - ı,î,ï,ì,í,į,ī - - ö,ô,œ,ò,ó,õ,ø,ō - - ü,û,ù,ú,ū - - ş,ß,ś,š - - ğ - - ç,ć,č - diff --git a/tools/maketext/res/values-be/donottranslate-more-keys.xml b/tools/maketext/res/values-be/donottranslate-more-keys.xml deleted file mode 100644 index 4723503f1..000000000 --- a/tools/maketext/res/values-be/donottranslate-more-keys.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - ў - - ё - - ы - - э - - і - - ё - - ъ - - АБВ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-bg/donottranslate-more-keys.xml b/tools/maketext/res/values-bg/donottranslate-more-keys.xml deleted file mode 100644 index 5262133de..000000000 --- a/tools/maketext/res/values-bg/donottranslate-more-keys.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - АБВ - - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-ca/donottranslate-more-keys.xml b/tools/maketext/res/values-ca/donottranslate-more-keys.xml deleted file mode 100644 index 8624dfb65..000000000 --- a/tools/maketext/res/values-ca/donottranslate-more-keys.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - à,á,ä,â,ã,å,ą,æ,ā,ª - - è,é,ë,ê,ę,ė,ē - - í,ï,ì,î,į,ī - - ò,ó,ö,ô,õ,ø,œ,ō,º - - ú,ü,ù,û,ū - - ñ,ń - - ç,ć,č - - l·l,ł - - "!fixedColumnOrder!9,·,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(,)" - \?,· - - ç - diff --git a/tools/maketext/res/values-cs/donottranslate-more-keys.xml b/tools/maketext/res/values-cs/donottranslate-more-keys.xml deleted file mode 100644 index 5ce1d3bc8..000000000 --- a/tools/maketext/res/values-cs/donottranslate-more-keys.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - á,à,â,ä,æ,ã,å,ā - - é,ě,è,ê,ë,ę,ė,ē - - í,î,ï,ì,į,ī - - ó,ö,ô,ò,õ,œ,ø,ō - - ú,ů,û,ü,ù,ū - - š,ß,ś - - ň,ñ,ń - - č,ç,ć - - ý,ÿ - - ď - - ř - - ť - - ž,ź,ż - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-da/donottranslate-more-keys.xml b/tools/maketext/res/values-da/donottranslate-more-keys.xml deleted file mode 100644 index cbaf9f497..000000000 --- a/tools/maketext/res/values-da/donottranslate-more-keys.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - á,ä,à,â,ã,ā - - é,ë - - í,ï - - ó,ô,ò,õ,œ,ō - - ú,ü,û,ù,ū - - ß,ś,š - - ñ,ń - - ý,ÿ - - ð - - ł - - å - - æ - - ø - - ä - - ö - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-de/donottranslate-more-keys.xml b/tools/maketext/res/values-de/donottranslate-more-keys.xml deleted file mode 100644 index 9dc8717ec..000000000 --- a/tools/maketext/res/values-de/donottranslate-more-keys.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - ä,â,à,á,æ,ã,å,ā - - é,è,ê,ë,ė - - ö,ô,ò,ó,õ,œ,ø,ō - - ü,û,ù,ú,ū - - ß,ś,š - - ñ,ń - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-el/donottranslate-more-keys.xml b/tools/maketext/res/values-el/donottranslate-more-keys.xml deleted file mode 100644 index 964dba081..000000000 --- a/tools/maketext/res/values-el/donottranslate-more-keys.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - ΑΒΓ - diff --git a/tools/maketext/res/values-en/donottranslate-more-keys.xml b/tools/maketext/res/values-en/donottranslate-more-keys.xml deleted file mode 100644 index 969a5041b..000000000 --- a/tools/maketext/res/values-en/donottranslate-more-keys.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - à,á,â,ä,æ,ã,å,ā - - è,é,ê,ë,ē - - î,ï,í,ī,ì - - ô,ö,ò,ó,œ,ø,ō,õ - - û,ü,ù,ú,ū - - ß - - ñ - - ç - diff --git a/tools/maketext/res/values-eo/donottranslate-more-keys.xml b/tools/maketext/res/values-eo/donottranslate-more-keys.xml deleted file mode 100644 index e929869e2..000000000 --- a/tools/maketext/res/values-eo/donottranslate-more-keys.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - á,à,â,ä,æ,ã,å,ā,ă,ą,ª - - é,ě,è,ê,ë,ę,ė,ē - - í,î,ï,ĩ,ì,į,ī,ı,ij - - ó,ö,ô,ò,õ,œ,ø,ō,ő,º - - ú,ů,û,ü,ù,ū,ũ,ű,ų,µ - - ß,š,ś,ș,ş - - ñ,ń,ņ,ň,ʼn,ŋ - - ć,č,ç,ċ - - y,ý,ŷ,ÿ,þ - - ð,ď,đ - - ř,ŕ,ŗ - - ť,ț,ţ,ŧ - - ź,ż,ž - - ķ,ĸ - - ĺ,ļ,ľ,ŀ,ł - - ğ,ġ,ģ - - w,ŵ - - ĥ,ħ - - w,ŵ - q - x - - ŝ - - ĝ - - ŭ - - ĉ - - ĵ - diff --git a/tools/maketext/res/values-es/donottranslate-more-keys.xml b/tools/maketext/res/values-es/donottranslate-more-keys.xml deleted file mode 100644 index 0e58c1440..000000000 --- a/tools/maketext/res/values-es/donottranslate-more-keys.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - á,à,ä,â,ã,å,ą,æ,ā,ª - - é,è,ë,ê,ę,ė,ē - - í,ï,ì,î,į,ī - - ó,ò,ö,ô,õ,ø,œ,ō,º - - ú,ü,ù,û,ū - - ñ,ń - - ç,ć,č - - ñ - - "!fixedColumnOrder!9,¡,\",\',#,-,:,!,\\,,\?,¿,\@,&,\\%,+,;,/,(,)" - - "!,¡" - - "\?,¿" - \" - \' - \' - diff --git a/tools/maketext/res/values-et/donottranslate-more-keys.xml b/tools/maketext/res/values-et/donottranslate-more-keys.xml deleted file mode 100644 index d037044bd..000000000 --- a/tools/maketext/res/values-et/donottranslate-more-keys.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - ä,ā,à,á,â,ã,å,æ,ą - - ē,è,ė,é,ê,ë,ę,ě - - ī,ì,į,í,î,ï,ı - - ö,õ,ò,ó,ô,œ,ő,ø - - ü,ū,ų,ù,ú,û,ů,ű - - š,ß,ś,ş - - ņ,ñ,ń,ń - - č,ç,ć - - ý,ÿ - - ď - - ŗ,ř,ŕ - - ţ,ť - - ž,ż,ź - - ķ - - ļ,ł,ĺ,ľ - - ģ,ğ - - ü - - ö - - ä - - õ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-fa/donottranslate-more-keys.xml b/tools/maketext/res/values-fa/donottranslate-more-keys.xml deleted file mode 100644 index 6d13d6bb6..000000000 --- a/tools/maketext/res/values-fa/donottranslate-more-keys.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - ا‌ب‌پ - - ۱ - - ۲ - - ۳ - - ۴ - - ۵ - - ۶ - - ۷ - - ۸ - - ۹ - - ۰ - - ۳۲۱؟ - - ۳۲۱ - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - - 0,٫,٬ - - ، - "\\," - ؟ - ؛ - - ٪ - \? - ; - - \\%,‰ - - "،" - "!" - "!,\\," - "؟" - "؟,\?" - ، - ؟ - "!fixedColumnOrder!4,:,!,؟,؛,-,/,«|»,»|«" - - "!fixedColumnOrder!8,\",\',#,-,:,!,،,؟,\@,&,\\%,+,؛,/,(|),)|(" - - - - ★,٭ - - - !fixedColumnOrder!4,﴾|﴿,<|>,{|},[|] - !fixedColumnOrder!4,﴿|﴾,>|<,}|{,]|[ - - !fixedColumnOrder!3,‹|›,≤|≥,<|> - !fixedColumnOrder!3,›|‹,≥|≤,>|< - !text/single_laqm_raqm_rtl - !text/double_laqm_raqm_rtl - - - - - "!fixedColumnOrder!7, ٕ|ٕ, ْ|ْ, ّ|ّ, ٌ|ٌ, ٍ|ٍ, ً|ً, ٔ|ٔ, ٖ|ٖ, ٰ|ٰ, ٓ|ٓ, ُ|ُ, ِ|ِ, َ|َ,ـــ|ـ" - ً - diff --git a/tools/maketext/res/values-fi/donottranslate-more-keys.xml b/tools/maketext/res/values-fi/donottranslate-more-keys.xml deleted file mode 100644 index 25b785845..000000000 --- a/tools/maketext/res/values-fi/donottranslate-more-keys.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - æ,à,á,â,ã,ā - - ø,ô,ò,ó,õ,œ,ō - - ü - - š,ß,ś - - ž,ź,ż - - å - - ö - - ä - - ø - - æ - diff --git a/tools/maketext/res/values-fr/donottranslate-more-keys.xml b/tools/maketext/res/values-fr/donottranslate-more-keys.xml deleted file mode 100644 index 7b11a183d..000000000 --- a/tools/maketext/res/values-fr/donottranslate-more-keys.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - à,â,%,æ,á,ä,ã,å,ā,ª - - é,è,ê,ë,%,ę,ė,ē - - î,%,ï,ì,í,į,ī - - ô,œ,%,ö,ò,ó,õ,ø,ō,º - - ù,û,%,ü,ú,ū - - ç,ć,č - - %,ÿ - diff --git a/tools/maketext/res/values-hi/donottranslate-more-keys.xml b/tools/maketext/res/values-hi/donottranslate-more-keys.xml deleted file mode 100644 index 98ad2cb3e..000000000 --- a/tools/maketext/res/values-hi/donottranslate-more-keys.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - कखग - - - - - - - - - - - - - - - - - - - - - - \?१२३ - - १२३ - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 0 - - - diff --git a/tools/maketext/res/values-hr/donottranslate-more-keys.xml b/tools/maketext/res/values-hr/donottranslate-more-keys.xml deleted file mode 100644 index 022bd2a87..000000000 --- a/tools/maketext/res/values-hr/donottranslate-more-keys.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - š,ś,ß - - ñ,ń - - ž,ź,ż - - č,ć,ç - - đ - !text/single_9qm_rqm - !text/double_9qm_rqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-hu/donottranslate-more-keys.xml b/tools/maketext/res/values-hu/donottranslate-more-keys.xml deleted file mode 100644 index ce2f5d057..000000000 --- a/tools/maketext/res/values-hu/donottranslate-more-keys.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - á,à,â,ä,æ,ã,å,ā - - é,è,ê,ë,ę,ė,ē - - í,î,ï,ì,į,ī - - ó,ö,ő,ô,ò,õ,œ,ø,ō - - ú,ü,ű,û,ù,ū - !text/single_9qm_rqm - !text/double_9qm_rqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-is/donottranslate-more-keys.xml b/tools/maketext/res/values-is/donottranslate-more-keys.xml deleted file mode 100644 index 4b4d986b8..000000000 --- a/tools/maketext/res/values-is/donottranslate-more-keys.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - á,ä,æ,å,à,â,ã,ā - - é,ë,è,ê,ę,ė,ē - - í,ï,î,ì,į,ī - - ó,ö,ô,ò,õ,œ,ø,ō - - ú,ü,û,ù,ū - - ý,ÿ - - ð - - þ - - ð - - æ - - þ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-it/donottranslate-more-keys.xml b/tools/maketext/res/values-it/donottranslate-more-keys.xml deleted file mode 100644 index 17dd03108..000000000 --- a/tools/maketext/res/values-it/donottranslate-more-keys.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - à,á,â,ä,æ,ã,å,ā,ª - - è,é,ê,ë,ę,ė,ē - - ì,í,î,ï,į,ī - - ò,ó,ô,ö,õ,œ,ø,ō,º - - ù,ú,û,ü,ū - diff --git a/tools/maketext/res/values-iw/donottranslate-more-keys.xml b/tools/maketext/res/values-iw/donottranslate-more-keys.xml deleted file mode 100644 index 9d2e01ebd..000000000 --- a/tools/maketext/res/values-iw/donottranslate-more-keys.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - אבג - "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(|),)|(" - - - - ±,﬩ - - !fixedColumnOrder!3,<|>,{|},[|] - !fixedColumnOrder!3,>|<,}|{,]|[ - - !fixedColumnOrder!3,‹|›,≤|≥,«|» - !fixedColumnOrder!3,›|‹,≥|≤,»|« - - ‘,’,‚ - “,”,„ - !text/single_laqm_raqm_rtl - !text/double_laqm_raqm_rtl - diff --git a/tools/maketext/res/values-ka/donottranslate-more-keys.xml b/tools/maketext/res/values-ka/donottranslate-more-keys.xml deleted file mode 100644 index 8c2add44c..000000000 --- a/tools/maketext/res/values-ka/donottranslate-more-keys.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - აბგ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-kk/donottranslate-more-keys.xml b/tools/maketext/res/values-kk/donottranslate-more-keys.xml deleted file mode 100644 index 0e953ff21..000000000 --- a/tools/maketext/res/values-kk/donottranslate-more-keys.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - щ - - ъ - - ы - - э - - и - - ү,ұ - - қ - - ё - - ң - - ғ - - і - - ә - - ө - - һ - - ъ - - АБВ - diff --git a/tools/maketext/res/values-ky/donottranslate-more-keys.xml b/tools/maketext/res/values-ky/donottranslate-more-keys.xml deleted file mode 100644 index 8d8c5fbf2..000000000 --- a/tools/maketext/res/values-ky/donottranslate-more-keys.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - щ - - ъ - - ы - - э - - и - - ү - - ё - - ң - - ө - - ъ - - АБВ - diff --git a/tools/maketext/res/values-lt/donottranslate-more-keys.xml b/tools/maketext/res/values-lt/donottranslate-more-keys.xml deleted file mode 100644 index 7e2b8a076..000000000 --- a/tools/maketext/res/values-lt/donottranslate-more-keys.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - ą,ä,ā,à,á,â,ã,å,æ - - ė,ę,ē,è,é,ê,ë,ě - - į,ī,ì,í,î,ï,ı - - ö,õ,ò,ó,ô,œ,ő,ø - - ū,ų,ü,ū,ù,ú,û,ů,ű - - š,ß,ś,ş - - ņ,ñ,ń,ń - - č,ç,ć - - ý,ÿ - - ď - - ŗ,ř,ŕ - - ţ,ť - - ž,ż,ź - - ķ - - ļ,ł,ĺ,ľ - - ģ,ğ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-lv/donottranslate-more-keys.xml b/tools/maketext/res/values-lv/donottranslate-more-keys.xml deleted file mode 100644 index c64e37bc8..000000000 --- a/tools/maketext/res/values-lv/donottranslate-more-keys.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - ā,à,á,â,ã,ä,å,æ,ą - - ē,ė,è,é,ê,ë,ę,ě - - ī,į,ì,í,î,ï,ı - - ò,ó,ô,õ,ö,œ,ő,ø - - ū,ų,ù,ú,û,ü,ů,ű - - š,ß,ś,ş - - ņ,ñ,ń,ń - - č,ç,ć - - ý,ÿ - - ď - - ŗ,ř,ŕ - - ţ,ť - - ž,ż,ź - - ķ - - ļ,ł,ĺ,ľ - - ģ,ğ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-mk/donottranslate-more-keys.xml b/tools/maketext/res/values-mk/donottranslate-more-keys.xml deleted file mode 100644 index 2db75c8f5..000000000 --- a/tools/maketext/res/values-mk/donottranslate-more-keys.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ѕ - - ќ - - з - - ѓ - - ѐ - - ѝ - - АБВ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-mn/donottranslate-more-keys.xml b/tools/maketext/res/values-mn/donottranslate-more-keys.xml deleted file mode 100644 index fd1853e85..000000000 --- a/tools/maketext/res/values-mn/donottranslate-more-keys.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - АБВ - - - diff --git a/tools/maketext/res/values-nb/donottranslate-more-keys.xml b/tools/maketext/res/values-nb/donottranslate-more-keys.xml deleted file mode 100644 index 2cecb5e65..000000000 --- a/tools/maketext/res/values-nb/donottranslate-more-keys.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - à,ä,á,â,ã,ā - - é,è,ê,ë,ę,ė,ē - - ô,ò,ó,ö,õ,œ,ō - - ü,û,ù,ú,ū - - å - - ø - - æ - - ö - - ä - !text/single_9qm_rqm - !text/double_9qm_rqm - diff --git a/tools/maketext/res/values-nl/donottranslate-more-keys.xml b/tools/maketext/res/values-nl/donottranslate-more-keys.xml deleted file mode 100644 index e5d82951a..000000000 --- a/tools/maketext/res/values-nl/donottranslate-more-keys.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - á,ä,â,à,æ,ã,å,ā - - é,ë,ê,è,ę,ė,ē - - í,ï,ì,î,į,ī,ij - - ó,ö,ô,ò,õ,œ,ø,ō - - ú,ü,û,ù,ū - - ñ,ń - - ij - !text/single_9qm_rqm - !text/double_9qm_rqm - diff --git a/tools/maketext/res/values-pl/donottranslate-more-keys.xml b/tools/maketext/res/values-pl/donottranslate-more-keys.xml deleted file mode 100644 index b5cf6a0fa..000000000 --- a/tools/maketext/res/values-pl/donottranslate-more-keys.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - ą,á,à,â,ä,æ,ã,å,ā - - ę,è,é,ê,ë,ė,ē - - ó,ö,ô,ò,õ,œ,ø,ō - - ś,ß,š - - ń,ñ - - ć,ç,č - - ż,ź,ž - - ł - !text/single_9qm_rqm - !text/double_9qm_rqm - diff --git a/tools/maketext/res/values-pt/donottranslate-more-keys.xml b/tools/maketext/res/values-pt/donottranslate-more-keys.xml deleted file mode 100644 index 0c9065f27..000000000 --- a/tools/maketext/res/values-pt/donottranslate-more-keys.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - á,ã,à,â,ä,å,æ,ª - - é,ê,è,ę,ė,ē,ë - - í,î,ì,ï,į,ī - - ó,õ,ô,ò,ö,œ,ø,ō,º - - ú,ü,ù,û,ū - - ç,č,ć - diff --git a/tools/maketext/res/values-rm/donottranslate-more-keys.xml b/tools/maketext/res/values-rm/donottranslate-more-keys.xml deleted file mode 100644 index aa0d7f817..000000000 --- a/tools/maketext/res/values-rm/donottranslate-more-keys.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - ò,ó,ö,ô,õ,œ,ø - diff --git a/tools/maketext/res/values-ro/donottranslate-more-keys.xml b/tools/maketext/res/values-ro/donottranslate-more-keys.xml deleted file mode 100644 index f399eb28e..000000000 --- a/tools/maketext/res/values-ro/donottranslate-more-keys.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - â,ã,ă,à,á,ä,æ,å,ā - - î,ï,ì,í,į,ī - - ș,ß,ś,š - - ț - !text/single_9qm_rqm - !text/double_9qm_rqm - diff --git a/tools/maketext/res/values-ru/donottranslate-more-keys.xml b/tools/maketext/res/values-ru/donottranslate-more-keys.xml deleted file mode 100644 index f62c90ffc..000000000 --- a/tools/maketext/res/values-ru/donottranslate-more-keys.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - щ - - ъ - - ы - - э - - и - - ё - - ъ - - АБВ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-sk/donottranslate-more-keys.xml b/tools/maketext/res/values-sk/donottranslate-more-keys.xml deleted file mode 100644 index 2ed538e5b..000000000 --- a/tools/maketext/res/values-sk/donottranslate-more-keys.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - á,ä,ā,à,â,ã,å,æ,ą - - é,ě,ē,ė,è,ê,ë,ę - - í,ī,į,ì,î,ï,ı - - ô,ó,ö,ò,õ,œ,ő,ø - - ú,ů,ü,ū,ų,ù,û,ű - - š,ß,ś,ş - - ň,ņ,ñ,ń,ń - - č,ç,ć - - ý,ÿ - - ď - - ŕ,ř,ŗ - - ť,ţ - - ž,ż,ź - - ķ - - ľ,ĺ,ļ,ł - - ģ,ğ - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-sl/donottranslate-more-keys.xml b/tools/maketext/res/values-sl/donottranslate-more-keys.xml deleted file mode 100644 index 1e5d1d71f..000000000 --- a/tools/maketext/res/values-sl/donottranslate-more-keys.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - š - - č,ć - - đ - - ž - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-sr/donottranslate-more-keys.xml b/tools/maketext/res/values-sr/donottranslate-more-keys.xml deleted file mode 100644 index c00d2a665..000000000 --- a/tools/maketext/res/values-sr/donottranslate-more-keys.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - з - - ћ - - ѕ - - ђ - - ѐ - - ѝ - - - АБВ - !text/single_9qm_lqm - !text/double_9qm_lqm - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-sv/donottranslate-more-keys.xml b/tools/maketext/res/values-sv/donottranslate-more-keys.xml deleted file mode 100644 index a36a13eb2..000000000 --- a/tools/maketext/res/values-sv/donottranslate-more-keys.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - é,è,ê,ë,ę - - œ,ô,ò,ó,õ,ō - - ü,û,ù,ú,ū - - ß,ś,š - - å - - ö - - ä - - ø - - æ - !text/single_raqm_laqm - !text/double_raqm_laqm - diff --git a/tools/maketext/res/values-sw/donottranslate-more-keys.xml b/tools/maketext/res/values-sw/donottranslate-more-keys.xml deleted file mode 100644 index 968a80c1c..000000000 --- a/tools/maketext/res/values-sw/donottranslate-more-keys.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - à,á,â,ä,æ,ã,å,ā - - è,é,ê,ë,ē - - î,ï,í,ī,ì - - ô,ö,ò,ó,œ,ø,ō,õ - - û,ü,ù,ú,ū - - ß - - ñ - - ç - g\' - diff --git a/tools/maketext/res/values-th/donottranslate-more-keys.xml b/tools/maketext/res/values-th/donottranslate-more-keys.xml deleted file mode 100644 index 6350d4b8e..000000000 --- a/tools/maketext/res/values-th/donottranslate-more-keys.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - กขค - - ฿ - diff --git a/tools/maketext/res/values-tl/donottranslate-more-keys.xml b/tools/maketext/res/values-tl/donottranslate-more-keys.xml deleted file mode 100644 index 383d55ccf..000000000 --- a/tools/maketext/res/values-tl/donottranslate-more-keys.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - á,à,ä,â,ã,å,ą,æ,ā,ª - - é,è,ë,ê,ę,ė,ē - - í,ï,ì,î,į,ī - - ó,ò,ö,ô,õ,ø,œ,ō,º - - ú,ü,ù,û,ū - - ñ,ń - - ç,ć,č - diff --git a/tools/maketext/res/values-tr/donottranslate-more-keys.xml b/tools/maketext/res/values-tr/donottranslate-more-keys.xml deleted file mode 100644 index 1161811d4..000000000 --- a/tools/maketext/res/values-tr/donottranslate-more-keys.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - â - - ı,î,ï,ì,í,į,ī - - ö,ô,œ,ò,ó,õ,ø,ō - - ü,û,ù,ú,ū - - ş,ß,ś,š - - ğ - - ç,ć,č - diff --git a/tools/maketext/res/values-uk/donottranslate-more-keys.xml b/tools/maketext/res/values-uk/donottranslate-more-keys.xml deleted file mode 100644 index cc05cc697..000000000 --- a/tools/maketext/res/values-uk/donottranslate-more-keys.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - щ - - ї - - і - - є - - и - - ґ - - ї - - ъ - - - - АБВ - !text/single_9qm_lqm - !text/double_9qm_lqm - diff --git a/tools/maketext/res/values-vi/donottranslate-more-keys.xml b/tools/maketext/res/values-vi/donottranslate-more-keys.xml deleted file mode 100644 index fa98ea9e1..000000000 --- a/tools/maketext/res/values-vi/donottranslate-more-keys.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - à,á,ả,ã,ạ,ă,ằ,ắ,ẳ,ẵ,ặ,â,ầ,ấ,ẩ,ẫ,ậ - - è,é,ẻ,ẽ,ẹ,ê,ề,ế,ể,ễ,ệ - - ì,í,ỉ,ĩ,ị - - ò,ó,ỏ,õ,ọ,ô,ồ,ố,ổ,ỗ,ộ,ơ,ờ,ớ,ở,ỡ,ợ - - ù,ú,ủ,ũ,ụ,ư,ừ,ứ,ử,ữ,ự - - ỳ,ý,ỷ,ỹ,ỵ - - đ - - - diff --git a/tools/maketext/res/values-zu/donottranslate-more-keys.xml b/tools/maketext/res/values-zu/donottranslate-more-keys.xml deleted file mode 100644 index 191791530..000000000 --- a/tools/maketext/res/values-zu/donottranslate-more-keys.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - à,á,â,ä,æ,ã,å,ā - - è,é,ê,ë,ē - - î,ï,í,ī,ì - - ô,ö,ò,ó,œ,ø,ō,õ - - û,ü,ù,ú,ū - - ß - - ñ - - ç - diff --git a/tools/maketext/res/values-zz/donottranslate-more-keys.xml b/tools/maketext/res/values-zz/donottranslate-more-keys.xml deleted file mode 100644 index eb984a469..000000000 --- a/tools/maketext/res/values-zz/donottranslate-more-keys.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - à,á,â,ã,ä,å,æ,ã,å,ā,ă,ą,ª - - è,é,ê,ë,ē,ĕ,ė,ę,ě - - ì,í,î,ï,ĩ,ī,ĭ,į,ı,ij - - ò,ó,ô,õ,ö,ø,ō,ŏ,ő,œ,º - - ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų - - ß,ś,ŝ,ş,š,ſ - - ñ,ń,ņ,ň,ʼn,ŋ - - ç,ć,ĉ,ċ,č - - ý,ŷ,ÿ,ij - - ď,đ,ð - - ŕ,ŗ,ř - - þ,ţ,ť,ŧ - - ź,ż,ž - - ķ,ĸ - - ĺ,ļ,ľ,ŀ,ł - - ĝ,ğ,ġ,ģ - - ĥ - - ĵ - - ŵ - diff --git a/tools/maketext/res/values/donottranslate-more-keys.xml b/tools/maketext/res/values/donottranslate-more-keys.xml deleted file mode 100644 index 4cf26505f..000000000 --- a/tools/maketext/res/values/donottranslate-more-keys.xml +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ABC - !text/single_lqm_rqm - !text/double_lqm_rqm - !text/single_laqm_raqm - !text/double_laqm_raqm - - ¢,£,€,¥,₱ - $ - $,¢,€,£,¥,₱ - "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,\?,\@,&,\\%,+,;,/,(,)" - - †,‡,★ - - ♪,♥,♠,♦,♣ - - ± - - !fixedColumnOrder!3,<,{,[ - !fixedColumnOrder!3,>,},] - - !fixedColumnOrder!3,‹,≤,« - !fixedColumnOrder!3,›,≥,» - - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 0 - - \?123 - - 123 - - - - - - - - - - - - ¹,½,⅓,¼,⅛ - - ²,⅔ - - ³,¾,⅜ - - - - - - - - - - - ⁿ,∅ - , - - \? - ; - % - - ¡ - - ¿ - - - - , - ! - ! - \? - \? - \' - \" - \" - - - q - w - y - x - - !fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm - !icon/settings_key|!code/key_settings - !icon/shortcut_key|!code/key_shortcut - !hasLabels!,\@string/label_next_key|!code/key_action_next - !hasLabels!,\@string/label_previous_key|!code/key_action_previous - - = \\ < - - ~ \\ { - - Tab - - 123 - - - *# - - "AM" - - "PM" - - Sym - ".com" - - "!hasLabels!,.net,.org,.gov,.edu" - "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ " - - - - ‹,› - ‹|›,›|‹ - ›,‹ - «,» - «|»,»|« - »,« - - ‚,‘,’ - ’,‚,‘ - ‘,‚,’ - „,“,” - ”,„,“ - “,„,” - !fixedColumnOrder!5,!text/single_quotes,!text/single_angle_quotes - !fixedColumnOrder!5,!text/double_quotes,!text/double_angle_quotes - !fixedColumnOrder!6,!text/double_quotes,!text/single_quotes,!text/double_angle_quotes,!text/single_angle_quotes - diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java deleted file mode 100644 index 3365c7273..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/ArrayInitializerFormatter.java +++ /dev/null @@ -1,89 +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.latin.maketext; - -import java.io.PrintStream; - -public class ArrayInitializerFormatter { - private final PrintStream mOut; - private final int mMaxWidth; - private final String mIndent; - - private int mCurrentIndex = 0; - private String mFixedElement; - private final StringBuilder mBuffer = new StringBuilder(); - private int mBufferedLen; - private int mBufferedIndex = Integer.MIN_VALUE; - - public ArrayInitializerFormatter(PrintStream out, int width, String indent) { - mOut = out; - mMaxWidth = width - indent.length(); - mIndent = indent; - } - - public void flush() { - if (mBuffer.length() == 0) { - 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]); - } else { - mOut.format("%s/* %d~ */\n" - + "%s%s\n" - + "%s/* ~%d */\n", mIndent, mBufferedIndex, - mIndent, mBuffer, - mIndent, lastIndex); - } - mBuffer.setLength(0); - mBufferedLen = 0; - } - - public void outCommentLines(String lines) { - flush(); - mOut.print(lines); - mFixedElement = null; - } - - public void outElement(String element) { - if (!element.equals(mFixedElement)) { - flush(); - mBufferedIndex = mCurrentIndex; - } - final int nextLen = mBufferedLen + " ".length() + element.length(); - if (mBufferedLen != 0 && nextLen < mMaxWidth) { - mBuffer.append(' '); - mBuffer.append(element); - mBufferedLen = nextLen; - } else { - if (mBufferedLen != 0) { - mBuffer.append('\n'); - mBuffer.append(mIndent); - } - mBuffer.append(element); - mBufferedLen = element.length(); - } - mCurrentIndex++; - mFixedElement = element; - } -} diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java deleted file mode 100644 index 6d6bc0ea6..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/JarUtils.java +++ /dev/null @@ -1,85 +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.latin.maketext; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -public final class JarUtils { - private JarUtils() { - // This utility class is not publicly instantiable. - } - - public static JarFile getJarFile(final Class mainClass) { - final String mainClassPath = "/" + mainClass.getName().replace('.', '/') + ".class"; - final URL resUrl = mainClass.getResource(mainClassPath); - if (!resUrl.getProtocol().equals("jar")) { - throw new RuntimeException("Should run as jar"); - } - final String path = resUrl.getPath(); - if (!path.startsWith("file:")) { - throw new RuntimeException("Unknown jar path: " + path); - } - final String jarPath = path.substring("file:".length(), path.indexOf('!')); - try { - return new JarFile(URLDecoder.decode(jarPath, "UTF-8")); - } catch (UnsupportedEncodingException e) { - } catch (IOException e) { - } - return null; - } - - public static InputStream openResource(final String name) { - return JarUtils.class.getResourceAsStream("/" + name); - } - - public interface JarFilter { - public boolean accept(String dirName, String name); - } - - public static ArrayList getNameListing(final JarFile jar, final JarFilter filter) { - final ArrayList result = new ArrayList(); - final Enumeration entries = jar.entries(); - while (entries.hasMoreElements()) { - final JarEntry entry = entries.nextElement(); - final String path = entry.getName(); - final int pos = path.lastIndexOf('/'); - final String dirName = (pos >= 0) ? path.substring(0, pos) : ""; - final String name = (pos >= 0) ? path.substring(pos + 1) : path; - if (filter.accept(dirName, name)) { - result.add(path); - } - } - return result; - } - - public static ArrayList getNameListing(final JarFile jar, final String filterName) { - return getNameListing(jar, new JarFilter() { - @Override - public boolean accept(final String dirName, final String name) { - return name.equals(filterName); - } - }); - } -} diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java deleted file mode 100644 index 4a9236962..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/LabelText.java +++ /dev/null @@ -1,65 +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.latin.maketext; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.NoSuchElementException; -import java.util.jar.JarFile; - -public class LabelText { - static class Options { - private static final String OPTION_JAVA = "-java"; - - public final String mJava; - - public static void usage(String message) { - if (message != null) { - System.err.println(message); - } - System.err.println("usage: makelabel " + OPTION_JAVA + " "); - System.exit(1); - } - - public Options(final String[] argsArray) { - final LinkedList args = new LinkedList(Arrays.asList(argsArray)); - String arg = null; - String java = null; - try { - while (!args.isEmpty()) { - arg = args.removeFirst(); - if (arg.equals(OPTION_JAVA)) { - java = args.removeFirst(); - } else { - usage("Unknown option: " + arg); - } - } - } catch (NoSuchElementException e) { - usage("Option " + arg + " needs argument"); - } - - mJava = java; - } - } - - public static void main(final String[] args) { - final Options options = new Options(args); - final JarFile jar = JarUtils.getJarFile(LabelText.class); - final MoreKeysResources resources = new MoreKeysResources(jar); - resources.writeToJava(options.mJava); - } -} diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java deleted file mode 100644 index fd427020e..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/MoreKeysResources.java +++ /dev/null @@ -1,264 +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.latin.maketext; - -import java.io.Closeable; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Locale; -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 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 EMPTY_STRING_VAR = "EMPTY"; - - private static final String NO_LANGUAGE_CODE = "zz"; - private static final String NO_LANGUAGE_DISPLAY_NAME = "Alphabet"; - - private final JarFile mJar; - // Language to string resources map. - private final HashMap mResourcesMap = - new HashMap(); - // Name to id map. - private final HashMap mNameToIdMap = new HashMap(); - - public MoreKeysResources(final JarFile jar) { - mJar = jar; - final ArrayList resources = JarUtils.getNameListing(jar, TEXT_RESOURCE_NAME); - for (final String name : resources) { - final String dirName = name.substring(0, name.lastIndexOf('/')); - final int pos = dirName.lastIndexOf('/'); - final String parentName = (pos >= 0) ? dirName.substring(pos + 1) : dirName; - final String language = getLanguageFromResDir(parentName); - final InputStream stream = JarUtils.openResource(name); - try { - mResourcesMap.put(language, new StringResourceMap(stream)); - } finally { - close(stream); - } - } - } - - private static String getLanguageFromResDir(final String dirName) { - final int languagePos = dirName.indexOf('-'); - if (languagePos < 0) { - // Default resource. - return DEFAUT_LANGUAGE_NAME; - } - final String language = dirName.substring(languagePos + 1); - final int countryPos = language.indexOf("-r"); - if (countryPos < 0) { - return language; - } - return language.replace("-r", "_"); - } - - public void writeToJava(final String outDir) { - final ArrayList list = JarUtils.getNameListing(mJar, JAVA_TEMPLATE); - if (list.isEmpty()) - throw new RuntimeException("Can't find java template " + JAVA_TEMPLATE); - 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; - LineNumberReader lnr = null; - try { - if (outDir == null) { - ps = System.out; - } else { - final File outPackage = new File(outDir, javaPackage); - final File outputFile = new File(outPackage, - JAVA_TEMPLATE.replace(".tmpl", ".java")); - outPackage.mkdirs(); - ps = new PrintStream(outputFile, "UTF-8"); - } - lnr = new LineNumberReader(new InputStreamReader(JarUtils.openResource(template))); - inflateTemplate(lnr, ps); - } catch (IOException e) { - throw new RuntimeException(e); - } finally { - close(lnr); - close(ps); - } - } - - private void inflateTemplate(final LineNumberReader in, final PrintStream out) - throws IOException { - String line; - while ((line = in.readLine()) != null) { - if (line.contains(MARK_NAMES)) { - dumpNames(out); - } else if (line.contains(MARK_DEFAULT_TEXTS)) { - dumpDefaultTexts(out); - } else if (line.contains(MARK_TEXTS)) { - dumpTexts(out); - } else if (line.contains(MARK_LANGUAGES_AND_TEXTS)) { - dumpLanguageMap(out); - } else { - out.println(line); - } - } - } - - 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++; - } - } - - private void dumpDefaultTexts(final PrintStream out) { - final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); - dumpTextsInternal(out, defaultResMap, defaultResMap); - } - - private void dumpTexts(final PrintStream out) { - final StringResourceMap defaultResMap = mResourcesMap.get(DEFAUT_LANGUAGE_NAME); - final ArrayList allLanguages = new ArrayList(); - 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); - 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); - out.format(" };\n\n"); - } - } - - private void dumpLanguageMap(final PrintStream out) { - final ArrayList allLanguages = new ArrayList(); - 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)); - } - } - - private static String getLanguageDisplayName(final String language) { - if (language.equals(NO_LANGUAGE_CODE)) { - return NO_LANGUAGE_DISPLAY_NAME; - } else { - return new Locale(language).getDisplayLanguage(); - } - } - - private static void dumpTextsInternal(final PrintStream out, final StringResourceMap resMap, - final StringResourceMap defaultResMap) { - final ArrayInitializerFormatter formatter = - new ArrayInitializerFormatter(out, 100, " "); - boolean successiveNull = false; - for (final StringResource defaultRes : defaultResMap.getResources()) { - if (resMap.contains(defaultRes.mName)) { - final StringResource res = resMap.get(defaultRes.mName); - if (res.mComment != null) { - formatter.outCommentLines(addPrefix(" // ", res. mComment)); - } - final String escaped = escapeNonAscii(res.mValue); - if (escaped.length() == 0) { - formatter.outElement(EMPTY_STRING_VAR + ","); - } else { - formatter.outElement(String.format("\"%s\",", escaped)); - } - successiveNull = false; - } else { - formatter.outElement("null,"); - successiveNull = true; - } - } - if (!successiveNull) { - formatter.flush(); - } - } - - private static String addPrefix(final String prefix, final String lines) { - final StringBuilder sb = new StringBuilder(); - for (final String line : lines.split("\n")) { - sb.append(prefix + line.trim() + "\n"); - } - return sb.toString(); - } - - private static String escapeNonAscii(final String text) { - final StringBuilder sb = new StringBuilder(); - final int length = text.length(); - for (int i = 0; i < length; i++) { - final char c = text.charAt(i); - if (c >= ' ' && c < 0x7f) { - sb.append(c); - } else { - 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; - } - - private static void close(Closeable stream) { - try { - if (stream != null) { - stream.close(); - } - } catch (IOException e) { - } - } -} diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java deleted file mode 100644 index 568a896a9..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResource.java +++ /dev/null @@ -1,29 +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.latin.maketext; - -public class StringResource { - public final String mName; - public final String mValue; - public final String mComment; - - public StringResource(final String name, final String value, final String comment) { - mName = name; - mValue = value; - mComment = comment; - } -} diff --git a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java b/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java deleted file mode 100644 index ff133425c..000000000 --- a/tools/maketext/src/com/android/inputmethod/latin/maketext/StringResourceMap.java +++ /dev/null @@ -1,135 +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.latin.maketext; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.ext.DefaultHandler2; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -public class StringResourceMap { - // String resource list. - private final List mResources; - // Name to string resource map. - private final Map mResourcesMap; - - public StringResourceMap(final InputStream is) { - final StringResourceHandler handler = new StringResourceHandler(); - final SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - try { - final SAXParser parser = factory.newSAXParser(); - // In order to get comment tag. - parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - parser.parse(is, handler); - } catch (ParserConfigurationException e) { - } catch (SAXParseException e) { - throw new RuntimeException(e.getMessage() + " at line " + e.getLineNumber() - + ", column " + e.getColumnNumber()); - } catch (SAXException e) { - throw new RuntimeException(e.getMessage()); - } catch (IOException e) { - } - - mResources = Collections.unmodifiableList(handler.mResources); - final HashMap map = new HashMap(); - for (final StringResource res : mResources) { - map.put(res.mName, res); - } - mResourcesMap = map; - } - - public List getResources() { - return mResources; - } - - public boolean contains(final String name) { - return mResourcesMap.containsKey(name); - } - - public StringResource get(final String name) { - return mResourcesMap.get(name); - } - - static class StringResourceHandler extends DefaultHandler2 { - private static final String TAG_RESOURCES = "resources"; - private static final String TAG_STRING = "string"; - private static final String ATTR_NAME = "name"; - - final ArrayList mResources = new ArrayList(); - - private String mName; - private final StringBuilder mValue = new StringBuilder(); - private final StringBuilder mComment = new StringBuilder(); - - private void init() { - mName = null; - mComment.setLength(0); - } - - @Override - public void comment(char[] ch, int start, int length) { - mComment.append(ch, start, length); - if (ch[start + length - 1] != '\n') { - mComment.append('\n'); - } - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attr) { - if (TAG_RESOURCES.equals(localName)) { - init(); - } else if (TAG_STRING.equals(localName)) { - mName = attr.getValue(ATTR_NAME); - mValue.setLength(0); - } - } - - @Override - public void characters(char[] ch, int start, int length) { - mValue.append(ch, start, length); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (TAG_STRING.equals(localName)) { - if (mName == null) - throw new SAXException(TAG_STRING + " doesn't have name"); - final String comment = mComment.length() > 0 ? mComment.toString() : null; - String value = mValue.toString(); - if (value.startsWith("\"") && value.endsWith("\"")) { - // Trim surroundings double quote. - value = value.substring(1, value.length() - 1); - } - mResources.add(new StringResource(mName, value, comment)); - init(); - } - } - } -} -- cgit v1.2.3-83-g751a