Translatable key descriptions

Key descriptions are shown in the "extra keys" option and can now be
translated.
This commit is contained in:
Jules Aguillon 2023-08-05 16:45:57 +02:00
parent 8b95053566
commit ae791ab292
18 changed files with 67 additions and 23 deletions

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -87,4 +87,7 @@
<string name="launcher_description">این برنامه یک صفحه کلید مجازی است. با کلیک روی گزینه زیر به تنظیمات سامانه بروید و صفحه کلید غیرمنتظره را فعال کنید.</string> <string name="launcher_description">این برنامه یک صفحه کلید مجازی است. با کلیک روی گزینه زیر به تنظیمات سامانه بروید و صفحه کلید غیرمنتظره را فعال کنید.</string>
<string name="launcher_sourcecode">این یک برنامه متن باز و آزاد است. شما می‌توانید کد منبع را در گیتهاب پیدا کرده و نیز باگ‌ها را گزارش کنید.</string> <string name="launcher_sourcecode">این یک برنامه متن باز و آزاد است. شما می‌توانید کد منبع را در گیتهاب پیدا کرده و نیز باگ‌ها را گزارش کنید.</string>
<string name="launcher_tryhere">بعد از فعالسازی، صفحه کلید را اینجا امتحان کنید:</string> <string name="launcher_tryhere">بعد از فعالسازی، صفحه کلید را اینجا امتحان کنید:</string>
<!-- <string name="key_descr_capslock">Caps lock</string> -->
<!-- <string name="key_descr_switch_greekmath">Greek &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="launcher_tryhere">Após ativar, experimente aqui:</string>
<!-- <string name="key_descr_capslock">Caps lock</string> -->
<!-- <string name="key_descr_switch_greekmath">Greek &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -87,4 +87,7 @@
<string name="launcher_description">Данное приложение является виртуальной клавиатурой. Зайдите в настройки, нажав кнопку внизу и активируйте Unexpected-Keyboard.</string> <string name="launcher_description">Данное приложение является виртуальной клавиатурой. Зайдите в настройки, нажав кнопку внизу и активируйте Unexpected-Keyboard.</string>
<string name="launcher_sourcecode">Это бесплатное приложение с открытым исходным кодом. Вы можете изучить код или сообщить об ошибках по ссылке Github.</string> <string name="launcher_sourcecode">Это бесплатное приложение с открытым исходным кодом. Вы можете изучить код или сообщить об ошибках по ссылке Github.</string>
<string name="launcher_tryhere">После активации вы можете попробовать клавиатуру прямо здесь:</string> <string name="launcher_tryhere">После активации вы можете попробовать клавиатуру прямо здесь:</string>
<!-- <string name="key_descr_capslock">Caps lock</string> -->
<!-- <string name="key_descr_switch_greekmath">Greek &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -87,4 +87,7 @@
<string name="launcher_description">这是一个虚拟键盘软件。点击按钮进入系统设置,然后启用 Unexpected-Keyboard 即可使用。</string> <string name="launcher_description">这是一个虚拟键盘软件。点击按钮进入系统设置,然后启用 Unexpected-Keyboard 即可使用。</string>
<string name="launcher_sourcecode">这是一个免费且开源的软件。你可以在 Github 上找到源代码或者反馈 bug。</string> <string name="launcher_sourcecode">这是一个免费且开源的软件。你可以在 Github 上找到源代码或者反馈 bug。</string>
<string name="launcher_tryhere">启用键盘后,可以在这里测试效果:</string> <string name="launcher_tryhere">启用键盘后,可以在这里测试效果:</string>
<!-- <string name="key_descr_capslock">Caps lock</string> -->
<!-- <string name="key_descr_switch_greekmath">Greek &amp; math symbols</string> -->
<!-- <string name="key_descr_voice_typing">Voice typing</string> -->
</resources> </resources>

View File

@ -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_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_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="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 &amp; math symbols</string>
<string name="key_descr_voice_typing">Voice typing</string>
</resources> </resources>

View File

@ -15,6 +15,7 @@ import java.util.Set;
possible extra keys. */ possible extra keys. */
public class ExtraKeysPreference extends PreferenceCategory public class ExtraKeysPreference extends PreferenceCategory
{ {
/** Array of the keys that can be selected. */
public static String[] extra_keys = new String[] public static String[] extra_keys = new String[]
{ {
"alt", "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. */ /** Get the set of enabled extra keys. */
public static Set<KeyValue> get_extra_keys(SharedPreferences prefs) public static Set<KeyValue> get_extra_keys(SharedPreferences prefs)
{ {
@ -111,13 +127,13 @@ public class ExtraKeysPreference extends PreferenceCategory
{ {
boolean _key_font; boolean _key_font;
public ExtraKeyCheckBoxPreference(Context context, String key_name, public ExtraKeyCheckBoxPreference(Context ctx, String key_name,
boolean default_checked) boolean default_checked)
{ {
super(context); super(ctx);
KeyValue kv = KeyValue.getKeyByName(key_name); KeyValue kv = KeyValue.getKeyByName(key_name);
String title = kv.getString(); String title = kv.getString();
String descr = KeyValue.getKeyDescription(key_name); String descr = key_description(ctx.getResources(), key_name);
if (descr != null) if (descr != null)
title += " (" + descr + ")"; title += " (" + descr + ")";
setKey(pref_key_of_key_name(key_name)); setKey(pref_key_of_key_name(key_name));

View File

@ -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. // Substitute for [assert], which has no effect on Android.
private static void check(boolean b) private static void check(boolean b)
{ {