Localize € and £

Show these characters only for users that have the corresponding locale
installed (a supported eu language for €, en-GB for £).
Add these characters to most layouts.
This commit is contained in:
Jules Aguillon 2022-02-19 21:48:48 +01:00
parent d73be58c1a
commit 632a9ac590
9 changed files with 54 additions and 48 deletions

View File

@ -4,11 +4,11 @@
<key key0="shift" width="1.5" key1="esc" key2="tab"/> <key key0="shift" width="1.5" key1="esc" key2="tab"/>
<key key0="p" key1="accent_ring" key2="." key3="&lt;"/> <key key0="p" key1="accent_ring" key2="." key3="&lt;"/>
<key key0="y" key1="accent_grave" key2="," key3="&gt;"/> <key key0="y" key1="accent_grave" key2="," key3="&gt;"/>
<key key0="f"/> <key key0="f" key4="€"/>
<key key0="g" key2="\\" key3="|"/> <key key0="g" key2="\\" key3="|"/>
<key key0="c" key1="accent_trema" key2="accent_circonflexe" key3="{" key4="}"/> <key key0="c" key1="accent_trema" key2="accent_circonflexe" key3="{" key4="}"/>
<key key0="r" key3="[" key4="]"/> <key key0="r" key3="[" key4="]"/>
<key key0="l" key2="=" key3="+"/> <key key0="l" key2="=" key3="+" key4="£"/>
<key key0="backspace" key2="delete" width="1.5"/> <key key0="backspace" key2="delete" width="1.5"/>
</row> </row>
<row> <row>

View File

@ -14,7 +14,7 @@
</row> </row>
<row> <row>
<key shift="0.5" key0="а" key1="tab" key2="`"/> <key shift="0.5" key0="а" key1="tab" key2="`"/>
<key key0="с"/> <key key0="с" key2="£"/>
<key key0="д" key1="accent_grave" key3="accent_aigu"/> <key key0="д" key1="accent_grave" key3="accent_aigu"/>
<key key0="ф"/> <key key0="ф"/>
<key key0="г" key1="accent_caron" key2="-" key3="_"/> <key key0="г" key1="accent_caron" key2="-" key3="_"/>

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true"> <input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true">
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig"/> <subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1|euro"/>
<subtype android:label="%s" android:languageTag="en" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/> <subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig|euro"/>
<subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|tilde|trema"/> <subtype android:label="%s" android:languageTag="en-GB" android:imeSubtypeLocale="en_GB" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=pound|euro"/>
<subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=grave|aigu|circonflexe|cedille|trema"/> <subtype android:label="%s" android:languageTag="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>
<subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=grave|aigu"/> <subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|tilde|trema|euro"/>
<subtype android:label="%s" android:languageTag="lv" android:imeSubtypeLocale="lv_LV" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_lv,extra_keys=caron|cedille|macron"/> <subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=grave|aigu|circonflexe|cedille|trema|euro"/>
<subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=grave|aigu|euro"/>
<subtype android:label="%s" android:languageTag="lv" android:imeSubtypeLocale="lv_LV" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_lv,extra_keys=caron|cedille|macron|euro"/>
<subtype android:label="%s" android:languageTag="pt" android:imeSubtypeLocale="pt_BR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|cedille|circonflexe|grave|tilde|euro"/>
<subtype android:label="%s" android:languageTag="ru" android:imeSubtypeLocale="ru_RU" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=ru_jcuken"/> <subtype android:label="%s" android:languageTag="ru" android:imeSubtypeLocale="ru_RU" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=ru_jcuken"/>
<subtype android:label="%s" android:languageTag="pt" android:imeSubtypeLocale="pt_BR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|cedille|circonflexe|grave|tilde"/> <subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|trema|ring|euro"/>
<subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|trema|ring"/>
<subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1"/>
</input-method> </input-method>

View File

@ -3,7 +3,7 @@
<row> <row>
<key key0="q" key1="esc" key2="1" key3="~" key4="!"/> <key key0="q" key1="esc" key2="1" key3="~" key4="!"/>
<key key0="w" key2="2" key3="\@"/> <key key0="w" key2="2" key3="\@"/>
<key key0="e" key2="3" key3="\#"/> <key key0="e" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$"/> <key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/> <key key0="t" key2="5" key3="%"/>
<key key0="y" key2="6" key3="^"/> <key key0="y" key2="6" key3="^"/>
@ -15,7 +15,7 @@
<row> <row>
<key shift="0.5" key0="a" key1="tab" key2="`"/> <key shift="0.5" key0="a" key1="tab" key2="`"/>
<key key0="s" key1="accent_ring" key3="ß"/> <key key0="s" key1="accent_ring" key3="ß"/>
<key key0="d" key1="accent_grave" key3="accent_aigu"/> <key key0="d" key1="accent_grave" key2="£" key3="accent_aigu"/>
<key key0="f"/> <key key0="f"/>
<key key0="g" key1="accent_caron" key2="-" key3="_"/> <key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/> <key key0="h" key2="=" key3="+"/>

View File

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<keyboard> <keyboard>
<row> <row>
<key key0="q" key1="esc" key2="1" key3="~" key4="!" /> <key key0="q" key1="esc" key2="1" key3="~" key4="!"/>
<key key0="w" key2="2" key3="\@" /> <key key0="w" key2="2" key3="\@"/>
<key key0="e" key1="ē" key2="3" key3="\#" /> <key key0="e" key1="ē" key2="3" key3="\#" key4="€"/>
<key key0="r" key1="ŗ" key2="4" key3="$" /> <key key0="r" key1="ŗ" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%" /> <key key0="t" key2="5" key3="%"/>
<key key0="y" key2="6" key3="^" /> <key key0="y" key2="6" key3="^"/>
<key key0="u" key1="ū" key2="7" key3="&amp;" /> <key key0="u" key1="ū" key2="7" key3="&amp;"/>
<key key0="i" key1="ī" key2="8" key3="*" /> <key key0="i" key1="ī" key2="8" key3="*"/>
<key key0="o" key1="ō" key2="9" key3="(" key4=")" /> <key key0="o" key1="ō" key2="9" key3="(" key4=")"/>
<key key0="p" key2="0" key3="{" key4="}" /> <key key0="p" key2="0" key3="{" key4="}"/>
</row> </row>
<row> <row>
<key shift="0.5" key0="a" key1="ā" /> <key shift="0.5" key0="a" key1="ā"/>
<key key0="s" key1="š" /> <key key0="s" key1="š" key3="ß"/>
<key key0="d" /> <key key0="d" key2="£"/>
<key key0="f" /> <key key0="f"/>
<key key0="g" key1="ģ" /> <key key0="g" key1="ģ"/>
<key key0="h" key2="accent_macron" key3="accent_caron" key4="accent_cedille" /> <key key0="h" key2="accent_macron" key3="accent_caron" key4="accent_cedille"/>
<key key0="j" key1="+" key2="=" key3="-" key4="_" /> <key key0="j" key1="+" key2="=" key3="-" key4="_"/>
<key key0="k" key1="ķ" key3="[" key4="]" /> <key key0="k" key1="ķ" key3="[" key4="]"/>
<key key0="l" key1="ļ" key2="|" key3="/" key4="\\" /> <key key0="l" key1="ļ" key2="|" key3="/" key4="\\"/>
</row> </row>
<row> <row>
<key width="1.5" key0="shift" key1="tab" /> <key width="1.5" key0="shift" key1="tab"/>
<key key0="z" key1="ž" /> <key key0="z" key1="ž"/>
<key key0="x" /> <key key0="x"/>
<key key0="c" key1="č" /> <key key0="c" key1="č"/>
<key key0="v" /> <key key0="v"/>
<key key0="b" key3="&lt;" key4="&gt;" /> <key key0="b" key3="&lt;" key4="&gt;"/>
<key key0="n" key1="ņ" key2="`" key3=":" key4=";" /> <key key0="n" key1="ņ" key2="`" key3=":" key4=";"/>
<key key0="m" key1="'" key2="&quot;" key3="," key4="\?" /> <key key0="m" key1="'" key2="&quot;" key3="," key4="\?"/>
<key width="1.5" key0="backspace" key2="delete" /> <key width="1.5" key0="backspace" key2="delete"/>
</row> </row>
</keyboard> </keyboard>

View File

@ -15,7 +15,7 @@
<row> <row>
<key shift="0.5" key0="a" key1="tab" key2="`" key3="ä"/> <key shift="0.5" key0="a" key1="tab" key2="`" key3="ä"/>
<key key0="s" key3="ß"/> <key key0="s" key3="ß"/>
<key key0="d"/> <key key0="d" key2="£"/>
<key key0="f" key1="~"/> <key key0="f" key1="~"/>
<key key0="g" key3="-"/> <key key0="g" key3="-"/>
<key key0="h" key3="+"/> <key key0="h" key3="+"/>

View File

@ -173,6 +173,8 @@ final class Config
case "macron": return KeyValue.FLAG_ACCENT_MACRON; case "macron": return KeyValue.FLAG_ACCENT_MACRON;
case "ring": return KeyValue.FLAG_ACCENT_RING; case "ring": return KeyValue.FLAG_ACCENT_RING;
case "szlig": return KeyValue.FLAG_LANG_SZLIG; case "szlig": return KeyValue.FLAG_LANG_SZLIG;
case "euro": return KeyValue.FLAG_LANG_EURO;
case "pound": return KeyValue.FLAG_LANG_POUND;
case "tilde": return KeyValue.FLAG_ACCENT4; case "tilde": return KeyValue.FLAG_ACCENT4;
case "trema": return KeyValue.FLAG_ACCENT6; case "trema": return KeyValue.FLAG_ACCENT6;
default: throw new RuntimeException(name); default: throw new RuntimeException(name);

View File

@ -56,8 +56,11 @@ class KeyValue
// Language specific keys // Language specific keys
public static final int FLAG_LANG_SZLIG = (1 << 25); public static final int FLAG_LANG_SZLIG = (1 << 25);
public static final int FLAG_LANG_EURO = (1 << 29);
public static final int FLAG_LANG_POUND = (1 << 30);
public static final int FLAGS_LANGS = FLAG_LANG_SZLIG; public static final int FLAGS_LANGS = FLAG_LANG_SZLIG | FLAG_LANG_EURO |
FLAG_LANG_POUND;
public static final int FLAGS_NOT_HIDDEN_ACCENTS = FLAG_ACCENT_SUPERSCRIPT | public static final int FLAGS_NOT_HIDDEN_ACCENTS = FLAG_ACCENT_SUPERSCRIPT |
FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL; FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL;
@ -148,10 +151,6 @@ class KeyValue
static static
{ {
String chars = "<>&\"_°~{|^}$*:!£%µ?.§€";
for (int i = 0; i < chars.length(); i++)
addCharKey(chars.charAt(i), EVENT_NONE);
addModifierKey("shift", "\uE808", FLAG_LOCK | FLAG_SHIFT | FLAG_KEY_FONT); addModifierKey("shift", "\uE808", FLAG_LOCK | FLAG_SHIFT | FLAG_KEY_FONT);
addModifierKey("ctrl", "Ctrl", FLAG_CTRL); addModifierKey("ctrl", "Ctrl", FLAG_CTRL);
addModifierKey("alt", "Alt", FLAG_ALT); addModifierKey("alt", "Alt", FLAG_ALT);
@ -224,6 +223,8 @@ class KeyValue
addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN); addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN);
addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN); addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN);
addCharKey('ß', EVENT_NONE, FLAG_LANG_SZLIG); addCharKey('ß', EVENT_NONE, FLAG_LANG_SZLIG);
addCharKey('€', EVENT_NONE, FLAG_LANG_EURO);
addCharKey('£', EVENT_NONE, FLAG_LANG_POUND);
addSpecialKey("config", "", EVENT_CONFIG); addSpecialKey("config", "", EVENT_CONFIG);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT); addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);

View File

@ -64,6 +64,8 @@ public class Keyboard2 extends InputMethodService
String s = subtype.getExtraValueOf("default_layout"); String s = subtype.getExtraValueOf("default_layout");
if (s != null) if (s != null)
l = Config.layoutId_of_string(s); l = Config.layoutId_of_string(s);
else
l = R.xml.qwerty;
} }
_currentTextLayout = l; _currentTextLayout = l;
} }