diff options
| author | Jules Aguillon | 2023-08-05 16:45:57 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-08-05 16:45:57 +0200 |
| commit | ae791ab2929c1b71d4af2831416aefccafc8e977 (patch) | |
| tree | 48860d82e5c18623d4de193b95c77ec78f99cfd5 | |
| parent | 8b9505356629f81340090cee4f8f1f0bb9c399be (diff) | |
| download | unexpected-keyboard-ae791ab2929c1b71d4af2831416aefccafc8e977.tar.gz unexpected-keyboard-ae791ab2929c1b71d4af2831416aefccafc8e977.zip | |
Translatable key descriptions
Key descriptions are shown in the "extra keys" option and can now be
translated.
| -rw-r--r-- | res/values-cs/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-de/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-es/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-fa/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-fr/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-it/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-ko/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-lv/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-pl/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-pt/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-ro/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-ru/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-tr/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-vi/strings.xml | 3 | ||||
| -rw-r--r-- | res/values-zh-rCN/strings.xml | 3 | ||||
| -rw-r--r-- | res/values/strings.xml | 3 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/ExtraKeysPreference.java | 22 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 20 |
18 files changed, 67 insertions, 23 deletions
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 1ae892b..d23fdff 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Tato aplikace je pouhou virtuální klávesnicí. Přejděte do systémového nastavení, kliknutím na tlačítko níže a aktivujte ji.</string> <string name="launcher_sourcecode">Toto je volná, open-source aplikace. Její zdrojový kód, či hlášení chyb, naleznete na Githubu.</string> <string name="launcher_tryhere">Po aktivaci můžete klávesnici rovnou vyzkoušet zde:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index e91fe04..525eb00 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Diese App ist eine virtuelle Tastatur. Tippe auf den Button unten und aktivere Unexpected Keyboard in den Systemeinstellungen.</string> <string name="launcher_sourcecode">Dies ist eine freie und quelloffene App. Du findest den Quellcode auf Github. Dort können auch Bugs gemeldet werden.</string> <string name="launcher_tryhere">Nach Aktivierung kannst du die Tastatur hier ausprobieren:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 556a816..19a5ce3 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Esta aplicación es un teclado virtual. Apretar el botón de abajo te facilitará habilitarlo.</string> <string name="launcher_sourcecode">Esta es una aplicación gratuita, libre y de fuente abierta. EL código fuente se puede encontrar también para reportar errores en Github.</string> <string name="launcher_tryhere">Tras habilitar, debajo se puede probar el teclado:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 27cc3c8..7a51cac 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">این برنامه یک صفحه کلید مجازی است. با کلیک روی گزینه زیر به تنظیمات سامانه بروید و صفحه کلید غیرمنتظره را فعال کنید.</string> <string name="launcher_sourcecode">این یک برنامه متن باز و آزاد است. شما میتوانید کد منبع را در گیتهاب پیدا کرده و نیز باگها را گزارش کنید.</string> <string name="launcher_tryhere">بعد از فعالسازی، صفحه کلید را اینجا امتحان کنید:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 834317d..f803caa 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Cette application est un clavier virtuel. Activez-le dans les paramètres système en cliquant sur le bouton ci-dessous.</string> <string name="launcher_sourcecode">Cette application est libre et open-source. Lisez le source code et reportez des problèmes sur Github.</string> <string name="launcher_tryhere">Après l\'avoir activé, vous pouvez l\'essayer ici:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 1f5bb09..eb1c814 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -87,4 +87,7 @@ <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> --> <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 0a5803f..b821996 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -87,4 +87,7 @@ <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> --> <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index d8caee6..31d54b3 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -87,4 +87,7 @@ <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> --> <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 9ee692b..9c5f25c 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Ta aplikacja jest klawiaturą ekranową. Naciśnij poniższy przycisk, aby przejść do ustawień systemu i włącz Unexpected-Keyboard.</string> <string name="launcher_sourcecode">Jest to darmowa aplikacja o otwartym kodzie źródłowym. Możesz zobaczyć kod źródłowy oraz zgłosić błedy na Githubie.</string> <string name="launcher_tryhere">Po jej włączeniu, możesz wypróbować klawiaturę tutaj:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 1480b22..3996b14 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Este app é um teclado virtual. Vá para as configurações do sistema clicando no botão abaixo e ative o Teclado Unexpected.</string> <string name="launcher_sourcecode">Este app é gratuito é de código aberto. Você pode consultar o código ou fazer sugestões em Github.</string> <string name="launcher_tryhere">Após ativar, experimente aqui:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 931eaa1..85d7f99 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Această aplicație este o tastatură virtuală. Accesați setările sistemului făcând clic pe butonul de mai jos și activați tastatura Unexpected.</string> <string name="launcher_sourcecode">Aceasta este o aplicație gratuită și open source. Puteți găsi codul sursă sau raporta erori folosind link-ul Github.</string> <string name="launcher_tryhere">După activare, puteți să încercați tastatura aici:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index ef60cc7..05eacb4 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">Данное приложение является виртуальной клавиатурой. Зайдите в настройки, нажав кнопку внизу и активируйте Unexpected-Keyboard.</string> <string name="launcher_sourcecode">Это бесплатное приложение с открытым исходным кодом. Вы можете изучить код или сообщить об ошибках по ссылке Github.</string> <string name="launcher_tryhere">После активации вы можете попробовать клавиатуру прямо здесь:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 9d651c5..5f7dccf 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -87,4 +87,7 @@ <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> --> <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index bacb839..291af47 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -89,4 +89,7 @@ <!-- <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> --> <!-- <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> --> <!-- <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> --> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 150aaee..f80e102 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">这是一个虚拟键盘软件。点击按钮进入系统设置,然后启用 Unexpected-Keyboard 即可使用。</string> <string name="launcher_sourcecode">这是一个免费且开源的软件。你可以在 Github 上找到源代码或者反馈 bug。</string> <string name="launcher_tryhere">启用键盘后,可以在这里测试效果:</string> + <!-- <string name="key_descr_capslock">Caps lock</string> --> + <!-- <string name="key_descr_switch_greekmath">Greek & math symbols</string> --> + <!-- <string name="key_descr_voice_typing">Voice typing</string> --> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 25c2438..2a164e0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -87,4 +87,7 @@ <string name="launcher_description">This application is a virtual keyboard. Go to the system settings by clicking on the button below and enable Unexpected-Keyboard.</string> <string name="launcher_sourcecode">This is an free and open source application. You can find the source code or report bugs on Github.</string> <string name="launcher_tryhere">After enabling, you can try the keyboard here:</string> + <string name="key_descr_capslock">Caps lock</string> + <string name="key_descr_switch_greekmath">Greek & math symbols</string> + <string name="key_descr_voice_typing">Voice typing</string> </resources> diff --git a/srcs/juloo.keyboard2/ExtraKeysPreference.java b/srcs/juloo.keyboard2/ExtraKeysPreference.java index 3af1c95..54cd0a4 100644 --- a/srcs/juloo.keyboard2/ExtraKeysPreference.java +++ b/srcs/juloo.keyboard2/ExtraKeysPreference.java @@ -15,6 +15,7 @@ import java.util.Set; possible extra keys. */ public class ExtraKeysPreference extends PreferenceCategory { + /** Array of the keys that can be selected. */ public static String[] extra_keys = new String[] { "alt", @@ -70,6 +71,21 @@ public class ExtraKeysPreference extends PreferenceCategory } } + /** Text that describe a key. Might be null. */ + static String key_description(Resources res, String name) + { + int id = 0; + switch (name) + { + case "capslock": id = R.string.key_descr_capslock; break; + case "switch_greekmath": id = R.string.key_descr_switch_greekmath; break; + case "voice_typing": id = R.string.key_descr_voice_typing; break; + } + if (id == 0) + return null; + return res.getString(id); + } + /** Get the set of enabled extra keys. */ public static Set<KeyValue> get_extra_keys(SharedPreferences prefs) { @@ -111,13 +127,13 @@ public class ExtraKeysPreference extends PreferenceCategory { boolean _key_font; - public ExtraKeyCheckBoxPreference(Context context, String key_name, + public ExtraKeyCheckBoxPreference(Context ctx, String key_name, boolean default_checked) { - super(context); + super(ctx); KeyValue kv = KeyValue.getKeyByName(key_name); String title = kv.getString(); - String descr = KeyValue.getKeyDescription(key_name); + String descr = key_description(ctx.getResources(), key_name); if (descr != null) title += " (" + descr + ")"; setKey(pref_key_of_key_name(key_name)); diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index f20c53e..a394240 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -448,26 +448,6 @@ final class KeyValue } } - static final HashMap<String, String> keys_descr = new HashMap<String, String>(); - - /* Some keys have a description attached. Return [null] if otherwise. */ - public static String getKeyDescription(String name) - { - return keys_descr.get(name); - } - - static void addKeyDescr(String name, String descr) - { - keys_descr.put(name, descr); - } - - static { - /* Keys description is shown in the settings. */ - addKeyDescr("capslock", "Caps lock"); - addKeyDescr("switch_greekmath", "Greek & math symbols"); - addKeyDescr("voice_typing", "Voice typing"); - } - // Substitute for [assert], which has no effect on Android. private static void check(boolean b) { |
