fix AZERTY, layout map generator

This commit is contained in:
Jörg Breitbart
2026-05-14 21:05:39 +02:00
parent e24b043ab2
commit 0d8996395c
3 changed files with 50 additions and 12 deletions
+38
View File
@@ -0,0 +1,38 @@
import fs from 'node:fs';
import path from 'node:path';
const DATA = {};
for (let i = 2; i < process.argv.length; ++i) {
const filename = process.argv[i];
const key = path.basename(filename).split('.')[0];
const value = JSON.parse(fs.readFileSync(filename));
DATA[key] = value;
}
let keys = [];
for (const map in DATA) {
keys = keys.concat(Object.keys(DATA[map]));
}
const KEYS = Array.from(new Set(keys)).sort();
const ACC = Object.fromEntries(Object.keys(DATA).map((el, i) => [el, i]));
const MAP = Object.fromEntries(KEYS.map(el => [el, []]));
for (const key of KEYS) {
for (const map in ACC) {
MAP[key].push(DATA[map][key]);
}
}
// minify if all entries are of length 1
for (const key in MAP) {
for (const c of MAP[key]) {
if (!c || c.length !== 1)
break;
}
MAP[key] = MAP[key].join('');
}
const FINAL = {acc: ACC, map: MAP};
console.log(FINAL);
console.log(JSON.stringify(FINAL).length);
+1 -1
View File
@@ -14,7 +14,7 @@
"Digit7": "7", "Digit7": "7",
"Digit8": "8", "Digit8": "8",
"Digit9": "9", "Digit9": "9",
"Equal": "'", "Equal": "´",
"IntlBackslash": "<", "IntlBackslash": "<",
"KeyA": "a", "KeyA": "a",
"KeyB": "b", "KeyB": "b",
+11 -11
View File
@@ -1,21 +1,21 @@
{ {
"Backquote": "\u00b2", "Backquote": "\u00b2",
"Backslash": "\u20ac", "Backslash": "μ",
"BracketLeft": "^", "BracketLeft": "^",
"BracketRight": "$", "BracketRight": "$",
"Comma": ";", "Comma": ";",
"Digit0": "0", "Digit0": "\u00e0",
"Digit1": "&", "Digit1": "&",
"Digit2": "\u00e9", "Digit2": "\u00e9",
"Digit3": "\"", "Digit3": "\"",
"Digit4": "'", "Digit4": "'",
"Digit5": "", "Digit5": "(",
"Digit6": "-", "Digit6": "§",
"Digit7": "\u00e8", "Digit7": "\u00e8",
"Digit8": "*", "Digit8": "!",
"Digit9": ")", "Digit9": "ç",
"Equal": "=", "Equal": "-",
"IntlBackslash": "\\", "IntlBackslash": "<",
"KeyA": "q", "KeyA": "q",
"KeyB": "b", "KeyB": "b",
"KeyC": "c", "KeyC": "c",
@@ -42,9 +42,9 @@
"KeyX": "x", "KeyX": "x",
"KeyY": "y", "KeyY": "y",
"KeyZ": "w", "KeyZ": "w",
"Minus": "_", "Minus": ")",
"Period": ".", "Period": ":",
"Quote": "\u00f9", "Quote": "\u00f9",
"Semicolon": "m", "Semicolon": "m",
"Slash": "/" "Slash": "="
} }