Specify localized keys in each layouts

Each layouts can chose which key are localized instead of specifying it
globally for each key.

Important keys are no longer removed from layouts if the 'extra_keys'
mechanism is not working properly. This can happen if language tags
specified in method.xml don't match the user's language.

Removed some currency symbols from some layouts. They are all in the Fn
layer.
This commit is contained in:
Jules Aguillon 2022-05-08 17:35:24 +02:00
parent 121a2ba76f
commit eb42943327
12 changed files with 91 additions and 80 deletions

View File

@ -14,13 +14,13 @@
</row>
<row>
<key key0="q" key2="tab"/>
<key key0="s" key1="accent_ring" key3="ß"/>
<key key0="s" key1="loc accent_ring" key3="loc ß"/>
<key key0="d" key1="accent_grave" key3="accent_aigu"/>
<key key0="f" key3="{" key4="}"/>
<key key0="g" key3="[" key4="]"/>
<key key0="h" key3="=" key4="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="^"/>
<key key0="k" key2="€" key3="$" key4="£"/>
<key key0="k" key2="€" key3="$"/>
<key key0="l" key2="%"/>
<key key0="m" key3="*"/>
</row>
@ -31,7 +31,7 @@
<key key0="c" key1="accent_cedille" key3="," key4="\?"/>
<key key0="v" key3=";" key4="."/>
<key key0="b" key3=":" key4="/"/>
<key key0="n" key1="accent_tilde" key2="§" key4="!"/>
<key key0="n" key1="loc accent_tilde" key2="§" key4="!"/>
<key width="2.0" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@ -2,32 +2,32 @@
<keyboard>
<row>
<key key0="shift" width="1.5" key2="esc" key4="tab"/>
<key key0="p" key1="accent_ring" key2="." key3="&lt;" key4="f11_placeholder"/>
<key key0="y" key1="accent_grave" key2="," key3="&gt;" key4="f12_placeholder"/>
<key key0="f" key4="€"/>
<key key0="p" key1="loc accent_ring" key2="." key3="&lt;" key4="f11_placeholder"/>
<key key0="y" key1="loc accent_grave" key2="," key3="&gt;" key4="f12_placeholder"/>
<key key0="f" key4="loc €"/>
<key key0="g" key2="\\" key3="|"/>
<key key0="c" key1="accent_trema" key2="accent_circonflexe" key3="{" key4="}"/>
<key key0="c" key1="loc accent_trema" key2="loc accent_circonflexe" key3="{" key4="}"/>
<key key0="r" key3="[" key4="]"/>
<key key0="l" key2="=" key3="+" key4="£"/>
<key key0="l" key2="=" key3="+" key4="loc £"/>
<key key0="backspace" key2="delete" width="1.5"/>
</row>
<row>
<key key0="a" key2="1" key4="!"/>
<key key0="o" key1="accent_macron" key2="2" key3="\@" key4="accent_ogonek"/>
<key key0="e" key1="accent_caron" key2="3" key3="\#" key4="accent_dot_above"/>
<key key0="u" key2="4" key3="$" key4="accent_double_aigu"/>
<key key0="o" key1="loc accent_macron" key2="2" key3="\@" key4="loc accent_ogonek"/>
<key key0="e" key1="loc accent_caron" key2="3" key3="\#" key4="loc accent_dot_above"/>
<key key0="u" key2="4" key3="$" key4="loc accent_double_aigu"/>
<key key0="i" key2="5" key3="%"/>
<key key0="d" key2="6" key3="^"/>
<key key0="h" key2="7" key3="&amp;"/>
<key key0="t" key2="8" key3="*"/>
<key key0="n" key2="9" key3="(" key4=")"/>
<key key0="s" key1="0" key3="ß"/>
<key key0="s" key1="0" key3="loc ß"/>
</row>
<row>
<key key0="q" shift="0.5" key1="accent_tilde" key2="`" key3="~"/>
<key key0="j" key1="accent_aigu" key2="'" key3="&quot;"/>
<key key0="q" shift="0.5" key1="loc accent_tilde" key2="`" key3="~"/>
<key key0="j" key1="loc accent_aigu" key2="'" key3="&quot;"/>
<key key0="k" key2=";" key3=":"/>
<key key0="x" key1="accent_cedille"/>
<key key0="x" key1="loc accent_cedille"/>
<key key0="b"/>
<key key0="m" key2="/" key3="\?"/>
<key key0="w"/>

View File

@ -9,28 +9,28 @@
<key key0="ъ" key2="6" key3="^" key4="€"/>
<key key0="у" key2="7" key3="&amp;" key4="§"/>
<key key0="и" key2="8" key3="*"/>
<key key0="о" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="о" key1="loc accent_macron" key2="9" key3="(" key4=")"/>
<key key0="п" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="а" key1="tab" key2="`"/>
<key key0="с" key2="£"/>
<key key0="д" key1="accent_grave" key3="accent_aigu"/>
<key key0="с"/>
<key key0="д" key1="loc accent_grave" key3="loc accent_aigu"/>
<key key0="ф"/>
<key key0="г" key1="accent_caron" key2="-" key3="_"/>
<key key0="г" key1="loc accent_caron" key2="-" key3="_"/>
<key key0="х" key2="=" key3="+"/>
<key key0="й" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="й" key1="loc accent_trema" key2="loc accent_circonflexe" key4="}" key3="{"/>
<key key0="к" key2="ш" key3="[" key4="]"/>
<key key0="л" key1="щ" key2="|" key3="\\" key4="ю"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="з"/>
<key key0="ь" key1="accent_ring" key3="ѝ"/>
<key key0="ц" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="ь" key1="loc accent_ring" key3="ѝ"/>
<key key0="ц" key1="loc accent_cedille" key2="&lt;" key3="."/>
<key key0="ж" key2="&gt;" key3=","/>
<key key0="б" key2="\?" key3="/"/>
<key key0="н" key1="accent_tilde" key2=":" key3=";"/>
<key key0="н" key1="loc accent_tilde" key2=":" key3=";"/>
<key key0="м" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>

View File

@ -14,17 +14,17 @@
<key key0="ß" key1="-"/>
</row>
<row>
<key key0="u" key1="tab" key2="accent_circonflexe" key4="\\"/>
<key key0="i" key2="accent_caron" key4="/"/>
<key key0="a" key2="accent_dot_above" key4="{"/>
<key key0="e" key2="accent_macron" key4="}"/>
<key key0="o" key2="accent_trema" key4="*"/>
<key key0="s" key2="accent_tilde" key4="\?"/>
<key key0="n" key2="accent_cedille" key4="("/>
<key key0="r" key2="accent_grave" key4=")"/>
<key key0="t" key2="accent_aigu" key4="-"/>
<key key0="d" key2="accent_ring" key4=":"/>
<key key0="y" key2="accent_double_aigu" key3="\@"/>
<key key0="u" key1="tab" key2="loc accent_circonflexe" key4="\\"/>
<key key0="i" key2="loc accent_caron" key4="/"/>
<key key0="a" key2="loc accent_dot_above" key4="{"/>
<key key0="e" key2="loc accent_macron" key4="}"/>
<key key0="o" key2="loc accent_trema" key4="*"/>
<key key0="s" key2="loc accent_tilde" key4="\?"/>
<key key0="n" key2="loc accent_cedille" key4="("/>
<key key0="r" key2="loc accent_grave" key4=")"/>
<key key0="t" key2="loc accent_aigu" key4="-"/>
<key key0="d" key2="loc accent_ring" key4=":"/>
<key key0="y" key2="loc accent_double_aigu" key3="\@"/>
</row>
<row>
<key width="1.5" key0="shift" key1="esc"/>

View File

@ -3,34 +3,34 @@
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@"/>
<key key0="e" key1="!" key2="3" key3="\#" key4="€"/>
<key key0="e" key1="!" key2="3" key3="\#" key4="loc €"/>
<key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="y" key2="6" key3="^"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="o" key1="loc accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="a" key1="tab" key2="`"/>
<key key0="s" key1="accent_ring" key3="ß" key4="accent_ogonek"/>
<key key0="d" key1="accent_grave" key2="£" key3="accent_aigu"/>
<key key0="f" key1="accent_dot_above"/>
<key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="s" key1="loc accent_ring" key3="loc ß" key4="loc accent_ogonek"/>
<key key0="d" key1="loc accent_grave" key2="loc £" key3="loc accent_aigu"/>
<key key0="f" key1="loc accent_dot_above"/>
<key key0="g" key1="loc accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key1="accent_double_aigu" key3="[" key4="]"/>
<key key0="j" key1="loc accent_trema" key2="loc accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key1="loc accent_double_aigu" key3="[" key4="]"/>
<key key0="l" key2="|" key3="\\"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="c" key1="loc accent_cedille" key2="&lt;" key3="."/>
<key key0="v" key2="&gt;" key3=","/>
<key key0="b" key2="\?" key3="/"/>
<key key0="n" key1="accent_tilde" key2=":" key3=";"/>
<key key0="n" key1="loc accent_tilde" key2=":" key3=";"/>
<key key0="m" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>

View File

@ -9,17 +9,17 @@
<key key0="y" key2="6" key3="^"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="o" key1="loc accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key key0="a" key2="tab" key4="`"/>
<key key0="s" key1="accent_ring" key2="¡" key3="ß"/>
<key key0="d" key1="accent_grave" key2="£" key3="accent_aigu"/>
<key key0="s" key1="loc accent_ring" key2="¡" key3="loc ß"/>
<key key0="d" key1="accent_grave" key3="accent_aigu"/>
<key key0="f"/>
<key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="g" key1="loc accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="j" key1="accent_trema" key2="loc accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key3="[" key4="]"/>
<key key0="l" key2="|" key3="\\"/>
<key key0="ñ" key1="·" key3="ç" />
@ -28,7 +28,7 @@
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="c" key1="loc accent_cedille" key2="&lt;" key3="."/>
<key key0="v" key2="&gt;" key3=","/>
<key key0="b" key2="\?" key3="/" key4="¿"/>
<key key0="n" key1="accent_tilde" key2=":" key3=";"/>

View File

@ -3,7 +3,7 @@
<row>
<key key0="ㅂ" key2="1" key4="esc"/>
<key key0="ㅈ" key1="~" key2="2" key3="\@"/>
<key key0="ㄷ" key1="!" key2="3" key3="\#" key4="€"/>
<key key0="ㄷ" key1="!" key2="3" key3="\#"/>
<key key0="ㄱ" key2="4" key3="$"/>
<key key0="ㅅ" key2="5" key3="%"/>
<key key0="ㅛ" key2="6" key3="^"/>
@ -14,8 +14,8 @@
</row>
<row>
<key shift="0.5" key0="ㅁ" key1="tab" key2="`"/>
<key key0="ㄴ" key3="ß"/>
<key key0="ㅇ" key2="£"/>
<key key0="ㄴ" key3="loc ß"/>
<key key0="ㅇ"/>
<key key0="ㄹ"/>
<key key0="ㅎ" key2="-" key3="_"/>
<key key0="ㅗ" key2="=" key3="+"/>

View File

@ -14,9 +14,9 @@
</row>
<row>
<key shift="0.5" key0="a" key1="ā" key2="tab"/>
<key key0="s" key1="š" key3="ß" key4="accent_ogonek"/>
<key key0="d" key2="£"/>
<key key0="f" key1="accent_dot_above"/>
<key key0="s" key1="š" key3="loc ß" key4="loc accent_ogonek"/>
<key key0="d"/>
<key key0="f" key1="loc accent_dot_above"/>
<key key0="g" key1="ģ"/>
<key key0="h" key2="accent_macron" key3="accent_caron" key4="accent_cedille"/>
<key key0="j" key1="+" key2="=" key3="-" key4="_"/>

View File

@ -3,10 +3,10 @@
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@" key4="!"/>
<key key0="e" key1="£" key2="3" key3="\#" key4="€"/>
<key key0="e" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="y" key1="accent_caron" key2="6" key3="^" key4="accent_trema"/>
<key key0="y" key1="loc accent_caron" key2="6" key3="^" key4="loc accent_trema"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key2="9" key3="(" key4=")"/>
@ -14,9 +14,9 @@
</row>
<row>
<key key0="a" key2="tab" key4="`"/>
<key key0="s" key1="'" key3="ß" key4="accent_cedille"/>
<key key0="d" key1="&quot;" key2="accent_ring"/>
<key key0="f" key2="accent_caron"/>
<key key0="s" key1="'" key3="loc ß" key4="accent_cedille"/>
<key key0="d" key1="&quot;" key2="loc accent_ring"/>
<key key0="f" key2="loc accent_caron"/>
<key key0="g"/>
<key key0="h"/>
<key key0="j" key1="-" key2="=" key4="+" key3="_"/>

View File

@ -15,9 +15,9 @@
</row>
<row>
<key key0="a" key2="tab"/>
<key key0="s" key1="accent_ring" key2="accent_cedille" key3="ß" key4="accent_tilde"/>
<key key0="d" key1="accent_grave" key2="accent_caron" key3="accent_aigu"/>
<key key0="f" key1="accent_trema" key2="accent_circonflexe"/>
<key key0="s" key1="accent_ring" key2="loc accent_cedille" key3="loc ß" key4="loc accent_tilde"/>
<key key0="d" key1="loc accent_grave" key2="loc accent_caron" key3="accent_aigu"/>
<key key0="f" key1="accent_trema" key2="loc accent_circonflexe"/>
<key key0="g"/>
<key key0="h"/>
<key key0="j" key1="{" key4="}"/>

View File

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

View File

@ -106,6 +106,14 @@ class KeyValue
flags = f;
}
private static String stripPrefix(String s, String prefix)
{
if (s.startsWith(prefix))
return s.substring(prefix.length());
else
return null;
}
public static KeyValue getKeyByName(String name)
{
if (name == null)
@ -113,6 +121,12 @@ class KeyValue
KeyValue kv = KeyValue.keys.get(name);
if (kv != null)
return kv;
String localized = stripPrefix(name, "loc ");
if (localized != null)
{
kv = getKeyByName(localized);
return kv.withFlags(kv.flags | FLAG_LOCALIZED);
}
char c = (name.length() == 1) ? name.charAt(0) : CHAR_NONE;
return new KeyValue(name, name, c, EVENT_NONE, 0);
}
@ -165,18 +179,18 @@ class KeyValue
FLAG_SHIFT | FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addModifierKey("ctrl", "Ctrl", FLAG_CTRL | FLAG_SMALLER_FONT);
addModifierKey("alt", "Alt", FLAG_ALT | FLAG_SMALLER_FONT);
addModifierKey("accent_aigu", "\u0050", FLAG_ACCENT2 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_caron", "\u0051", FLAG_ACCENT_CARON | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_cedille", "\u0052", FLAG_ACCENT5 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_circonflexe", "\u0053", FLAG_ACCENT3 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_grave", "\u0054", FLAG_ACCENT1 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_macron", "\u0055", FLAG_ACCENT_MACRON | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_ring", "\u0056", FLAG_ACCENT_RING | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_tilde", "\u0057", FLAG_ACCENT4 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_trema", "\u0058", FLAG_ACCENT6 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_ogonek", "\u0059", FLAG_ACCENT_OGONEK | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_dot_above", "\u005a", FLAG_ACCENT_DOT_ABOVE | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_double_aigu", "\u005b", FLAG_ACCENT_DOUBLE_AIGU | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_aigu", "\u0050", FLAG_ACCENT2 | FLAG_KEY_FONT);
addModifierKey("accent_caron", "\u0051", FLAG_ACCENT_CARON | FLAG_KEY_FONT);
addModifierKey("accent_cedille", "\u0052", FLAG_ACCENT5 | FLAG_KEY_FONT);
addModifierKey("accent_circonflexe", "\u0053", FLAG_ACCENT3 | FLAG_KEY_FONT);
addModifierKey("accent_grave", "\u0054", FLAG_ACCENT1 | FLAG_KEY_FONT);
addModifierKey("accent_macron", "\u0055", FLAG_ACCENT_MACRON | FLAG_KEY_FONT);
addModifierKey("accent_ring", "\u0056", FLAG_ACCENT_RING | FLAG_KEY_FONT);
addModifierKey("accent_tilde", "\u0057", FLAG_ACCENT4 | FLAG_KEY_FONT);
addModifierKey("accent_trema", "\u0058", FLAG_ACCENT6 | FLAG_KEY_FONT);
addModifierKey("accent_ogonek", "\u0059", FLAG_ACCENT_OGONEK | FLAG_KEY_FONT);
addModifierKey("accent_dot_above", "\u005a", FLAG_ACCENT_DOT_ABOVE | FLAG_KEY_FONT);
addModifierKey("accent_double_aigu", "\u005b", FLAG_ACCENT_DOUBLE_AIGU | FLAG_KEY_FONT);
addModifierKey("superscript", "Sup", FLAG_ACCENT_SUPERSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("subscript", "Sub", FLAG_ACCENT_SUBSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("ordinal", "Ord", FLAG_ACCENT_ORDINAL | FLAG_SMALLER_FONT);
@ -238,9 +252,6 @@ class KeyValue
addCharKey('#', KeyEvent.KEYCODE_POUND);
addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN);
addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN);
addCharKey('ß', EVENT_NONE, FLAG_LOCALIZED);
addCharKey('€', EVENT_NONE, FLAG_LOCALIZED);
addCharKey('£', EVENT_NONE, FLAG_LOCALIZED);
addSpecialKey("config", "\u0004", EVENT_CONFIG, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT, FLAG_SMALLER_FONT);