Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/keyboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ describe("Keyboard Layout Structure Validation", () => {
expect(rowLengths).toEqual(ORIGINAL_ROW_LENGTHS);
});

it(`should have ANSI/ISO additional buttons to be same on ${layoutKey} layout`, () => {
expect(layout[1][12]).toEqual(layout[3][1]);
});

ORIGINAL_LAYOUT.forEach((originalRow, rowIndex) => {
it(`should have row ${rowIndex + 1} with ${originalRow.length} elements`, () => {
expect(layout[rowIndex]).toHaveLength(originalRow.length);
Expand Down
16 changes: 14 additions & 2 deletions src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const ORIGINAL_LAYOUT: string[][] = [
];

// https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
export type LanguageCode = "TH" | "TR" | "VI" | "LO";
export type LanguageCode = "TH" | "TR" | "VI" | "LO" | "IT";
export type LayoutKey = LanguageCode | `${LanguageCode}_`;

export const KEYBOARD_LAYOUTS: Record<LayoutKey, string[][]> = {
Expand All @@ -38,7 +38,7 @@ export const KEYBOARD_LAYOUTS: Record<LayoutKey, string[][]> = {
[SHIFT, ",", "z", "x", "c", "v", "b", "n", "m", "ö", "ç", ".", SPACE],
],
TR_: [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "*", "-", BACKSPACE],
["!", "'", "^", "+", "%", "&", "/", "(", ")", "=", "?", "_", BACKSPACE],
["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "Ğ", "Ü", ";"],
["A", "S", "D", "F", "G", "H", "J", "K", "L", "Ş", "İ", ENTER],
[SHIFT, ";", "Z", "X", "C", "V", "B", "N", "M", "Ö", "Ç", ":", SPACE],
Expand Down Expand Up @@ -67,4 +67,16 @@ export const KEYBOARD_LAYOUTS: Record<LayoutKey, string[][]> = {
["ັ້", ";", ".", ",", ":", "໊", "໋", "!", "?", "%", "=", ENTER],
[SHIFT, "\\", "₭", "(", "ຯ", "x", "ຶ້", "ື້", "ໆ", "ໝ", "$", ")", SPACE],
],
IT: [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "'", "ì", BACKSPACE],
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "è", "+", "ù"],
["a", "s", "d", "f", "g", "h", "j", "k", "l", "ò", "à", ENTER],
[SHIFT, "ù", "z", "x", "c", "v", "b", "n", "m", ",", ".", "-", SPACE],
],
IT_: [
["!", '"', "£", "$", "%", "&", "/", "(", ")", "=", "?", "í", BACKSPACE],
["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "é", "*", "ú"],
["A", "S", "D", "F", "G", "H", "J", "K", "L", "ç", "ó", ENTER],
[SHIFT, "ú", "Z", "X", "C", "V", "B", "N", "M", ";", ":", "_", SPACE],
],
};
21 changes: 14 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,20 @@ document.addEventListener("DOMContentLoaded", async () => {
const languagesSubmenu = await Submenu.new({
text: "Languages",
items: [
await MenuItem.new({
id: "italian",
text: "Select Italian",
action: () => {
app.setLanguage("IT");
},
}),
await MenuItem.new({
id: "lao",
text: "Select Lao",
action: () => {
app.setLanguage("LO");
},
}),
await MenuItem.new({
id: "thai",
text: "Select Thai",
Expand All @@ -400,13 +414,6 @@ document.addEventListener("DOMContentLoaded", async () => {
app.setLanguage("VI");
},
}),
await MenuItem.new({
id: "lao",
text: "Select Lao",
action: () => {
app.setLanguage("LO");
},
}),
],
});

Expand Down