From 632a9ac590b92a52afe57f1f0aaaa919f9dcebdc Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 19 Feb 2022 21:48:48 +0100 Subject: [PATCH] =?UTF-8?q?Localize=20=E2=82=AC=20and=20=C2=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- res/xml/dvorak.xml | 4 +-- res/xml/local_bgph1.xml | 2 +- res/xml/method.xml | 19 +++++----- res/xml/qwerty.xml | 4 +-- res/xml/qwerty_lv.xml | 56 ++++++++++++++--------------- res/xml/qwertz.xml | 2 +- srcs/juloo.keyboard2/Config.java | 2 ++ srcs/juloo.keyboard2/KeyValue.java | 11 +++--- srcs/juloo.keyboard2/Keyboard2.java | 2 ++ 9 files changed, 54 insertions(+), 48 deletions(-) diff --git a/res/xml/dvorak.xml b/res/xml/dvorak.xml index c659925..6c12bd1 100644 --- a/res/xml/dvorak.xml +++ b/res/xml/dvorak.xml @@ -4,11 +4,11 @@ - + - + diff --git a/res/xml/local_bgph1.xml b/res/xml/local_bgph1.xml index 9f8a6e9..7b31586 100644 --- a/res/xml/local_bgph1.xml +++ b/res/xml/local_bgph1.xml @@ -14,7 +14,7 @@ - + diff --git a/res/xml/method.xml b/res/xml/method.xml index c83ee35..2d40cc0 100644 --- a/res/xml/method.xml +++ b/res/xml/method.xml @@ -1,13 +1,14 @@ - - - - - - + + + + + + + + + - - - + diff --git a/res/xml/qwerty.xml b/res/xml/qwerty.xml index 47e1078..ffd7ed7 100644 --- a/res/xml/qwerty.xml +++ b/res/xml/qwerty.xml @@ -3,7 +3,7 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/res/xml/qwerty_lv.xml b/res/xml/qwerty_lv.xml index d181f5d..ca087c3 100644 --- a/res/xml/qwerty_lv.xml +++ b/res/xml/qwerty_lv.xml @@ -1,37 +1,37 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/res/xml/qwertz.xml b/res/xml/qwertz.xml index c8acf16..a0cb1ec 100644 --- a/res/xml/qwertz.xml +++ b/res/xml/qwertz.xml @@ -15,7 +15,7 @@ - + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 2a2be30..3e3d349 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -173,6 +173,8 @@ final class Config case "macron": return KeyValue.FLAG_ACCENT_MACRON; case "ring": return KeyValue.FLAG_ACCENT_RING; 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 "trema": return KeyValue.FLAG_ACCENT6; default: throw new RuntimeException(name); diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index fa5b4a6..8ce3cbe 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -56,8 +56,11 @@ class KeyValue // Language specific keys 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 | FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL; @@ -148,10 +151,6 @@ class KeyValue 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("ctrl", "Ctrl", FLAG_CTRL); addModifierKey("alt", "Alt", FLAG_ALT); @@ -224,6 +223,8 @@ class KeyValue addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN); addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN); addCharKey('ß', EVENT_NONE, FLAG_LANG_SZLIG); + addCharKey('€', EVENT_NONE, FLAG_LANG_EURO); + addCharKey('£', EVENT_NONE, FLAG_LANG_POUND); addSpecialKey("config", "⛭", EVENT_CONFIG); addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT); diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 7f02ea7..0ce3af8 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -64,6 +64,8 @@ public class Keyboard2 extends InputMethodService String s = subtype.getExtraValueOf("default_layout"); if (s != null) l = Config.layoutId_of_string(s); + else + l = R.xml.qwerty; } _currentTextLayout = l; }