[gnome-shell/wip/fmuellner/pardon-my-french: 10/77] Add level modifiers in JSON
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/pardon-my-french: 10/77] Add level modifiers in JSON
- Date: Mon, 4 Mar 2019 17:25:37 +0000 (UTC)
commit 67d083c3fe425129fc228516e2c7e048845e32d9
Author: Alan <alan boum org>
Date: Wed Aug 2 15:26:32 2017 +0000
Add level modifiers in JSON
This is needed because some layouts don't have an uppercase level.
That shouldn't make symbols the 2nd level.
cldr2json.py | 10 ++++++----
test/data/fr.json | 10 +++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/cldr2json.py b/cldr2json.py
index 1a2574698..0d4fcc6d5 100755
--- a/cldr2json.py
+++ b/cldr2json.py
@@ -97,19 +97,21 @@ def convert_xml(tree):
root["levels"] = []
# parse levels
for index, keymap in enumerate(tree.iter('keyMap')):
- level = {}
- root["levels"].append(level)
- level["level"] = index + 1
# FIXME: heuristics here
modifiers = keymap.get('modifiers')
if not modifiers:
mode = 'default'
- elif 'shift' in modifiers.split(' ') or 'lock' in modifiers.split(' '):
+ modifiers = ''
+ elif 'shift' in modifiers.split(' '):
mode = 'latched'
+ modifiers = 'shift'
else:
mode = 'locked'
+ level = {}
+ level["level"] = modifiers
level["mode"] = mode
level["rows"] = parse_rows(keymap)
+ root["levels"].append(level)
return root
diff --git a/test/data/fr.json b/test/data/fr.json
index 2aeb67479..3a8949fe1 100644
--- a/test/data/fr.json
+++ b/test/data/fr.json
@@ -1,7 +1,7 @@
{
"levels": [
{
- "level": 1,
+ "level": "",
"mode": "default",
"rows": [
[
@@ -163,7 +163,7 @@
]
},
{
- "level": 2,
+ "level": "shift",
"mode": "latched",
"rows": [
[
@@ -325,7 +325,7 @@
]
},
{
- "level": 3,
+ "level": "opt",
"mode": "locked",
"rows": [
[
@@ -478,7 +478,7 @@
]
},
{
- "level": 4,
+ "level": "opt+shift",
"mode": "locked",
"rows": [
[
@@ -611,4 +611,4 @@
],
"locale": "fr",
"name": "French"
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]