Move language name definitions into the keyboard layout files

This commit is contained in:
Daniel Lorch 2025-05-08 20:26:59 +02:00
parent 4d840b65a9
commit 48240eebe0
12 changed files with 59 additions and 37 deletions

View File

@ -1,42 +1,42 @@
import { chars as chars_cs_CZ } from "@/keyboardLayouts/cs_CZ"
import { chars as chars_en_UK } from "@/keyboardLayouts/en_UK"
import { chars as chars_en_US } from "@/keyboardLayouts/en_US"
import { chars as chars_fr_FR } from "@/keyboardLayouts/fr_FR"
import { chars as chars_de_DE } from "@/keyboardLayouts/de_DE"
import { chars as chars_it_IT } from "@/keyboardLayouts/it_IT"
import { chars as chars_nb_NO } from "@/keyboardLayouts/nb_NO"
import { chars as chars_es_ES } from "@/keyboardLayouts/es_ES"
import { chars as chars_sv_SE } from "@/keyboardLayouts/sv_SE"
import { chars as chars_fr_CH } from "@/keyboardLayouts/fr_CH"
import { chars as chars_de_CH } from "@/keyboardLayouts/de_CH"
import { chars as chars_cs_CZ, name as name_cs_CZ } from "@/keyboardLayouts/cs_CZ"
import { chars as chars_en_UK, name as name_en_UK } from "@/keyboardLayouts/en_UK"
import { chars as chars_en_US, name as name_en_US } from "@/keyboardLayouts/en_US"
import { chars as chars_fr_FR, name as name_fr_FR } from "@/keyboardLayouts/fr_FR"
import { chars as chars_de_DE, name as name_de_DE } from "@/keyboardLayouts/de_DE"
import { chars as chars_it_IT, name as name_it_IT } from "@/keyboardLayouts/it_IT"
import { chars as chars_nb_NO, name as name_nb_NO } from "@/keyboardLayouts/nb_NO"
import { chars as chars_es_ES, name as name_es_ES } from "@/keyboardLayouts/es_ES"
import { chars as chars_sv_SE, name as name_sv_SE } from "@/keyboardLayouts/sv_SE"
import { chars as chars_fr_CH, name as name_fr_CH } from "@/keyboardLayouts/fr_CH"
import { chars as chars_de_CH, name as name_de_CH } from "@/keyboardLayouts/de_CH"
type KeyInfo = { key: string | number; shift?: boolean, altRight?: boolean }
export type KeyCombo = KeyInfo & { deadKey?: boolean, accentKey?: KeyInfo }
export const layouts = {
"cs_CZ": "Czech",
"en_UK": "English (UK)",
"en_US": "English (US)",
"fr_FR": "French",
"de_DE": "German",
"it_IT": "Italian",
"nb_NO": "Norwegian",
"es_ES": "Spanish",
"sv_SE": "Swedish",
"fr_CH": "Swiss French",
"de_CH": "Swiss German"
} as Record<string, string>;
export const layouts: Record<string, string> = {
cs_CZ: name_cs_CZ,
en_UK: name_en_UK,
en_US: name_en_US,
fr_FR: name_fr_FR,
de_DE: name_de_DE,
it_IT: name_it_IT,
nb_NO: name_nb_NO,
es_ES: name_es_ES,
sv_SE: name_sv_SE,
fr_CH: name_fr_CH,
de_CH: name_de_CH,
}
export const chars = {
"cs_CZ": chars_cs_CZ,
"en_UK": chars_en_UK,
"en_US": chars_en_US,
"fr_FR": chars_fr_FR,
"de_DE": chars_de_DE,
"it_IT": chars_it_IT,
"nb_NO": chars_nb_NO,
"es_ES": chars_es_ES,
"sv_SE": chars_sv_SE,
"fr_CH": chars_fr_CH,
"de_CH": chars_de_CH,
} as Record<string, Record <string, KeyCombo>>
export const chars: Record<string, Record<string, KeyCombo>> = {
cs_CZ: chars_cs_CZ,
en_UK: chars_en_UK,
en_US: chars_en_US,
fr_FR: chars_fr_FR,
de_DE: chars_de_DE,
it_IT: chars_it_IT,
nb_NO: chars_nb_NO,
es_ES: chars_es_ES,
sv_SE: chars_sv_SE,
fr_CH: chars_fr_CH,
de_CH: chars_de_CH,
};

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Czech";
const keyTrema = { key: "Backslash" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Digit3", shift: true, altRight: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Swiss German";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Minus", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Equal" } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "German";
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "Backquote" } // accent circonflexe (accent hat), mark ^ placed above the letter
const keyGrave = { key: "Equal", shift: true } // accent grave, mark ` placed above the letter

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "English (UK)";
export const chars = {
A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true },

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "English (US)";
export const chars = {
A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true },

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Spanish";
const keyTrema = { key: "Quote", shift: true } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Quote" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,6 +1,8 @@
import { KeyCombo } from "../keyboardLayouts"
import { chars as chars_de_CH } from "./de_CH"
export const name = "Swiss French";
export const chars = {
...chars_de_CH,
"è": { key: "BracketLeft" },

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "French";
const keyTrema = { key: "BracketLeft", shift: true } // tréma (umlaut), two dots placed above a vowel
const keyHat = { key: "BracketLeft" } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Italian";
export const chars = {
A: { key: "KeyA", shift: true },
B: { key: "KeyB", shift: true },

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Norwegian";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal", altRight: true } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter

View File

@ -1,5 +1,7 @@
import { KeyCombo } from "../keyboardLayouts"
export const name = "Swedish";
const keyTrema = { key: "BracketRight" } // tréma (umlaut), two dots placed above a vowel
const keyAcute = { key: "Equal" } // accent aigu (acute accent), mark ´ placed above the letter
const keyHat = { key: "BracketRight", shift: true } // accent circonflexe (accent hat), mark ^ placed above the letter