🌐(frontend) localize SR modifier labels

Replace hardcoded 'Alt'/'Shift' in SR formatter with i18next
labels. Use Option/Alt distinction on Mac like Ctrl/Command.
This commit is contained in:
Cyril
2026-02-24 09:13:03 +01:00
parent 7bf623f654
commit fcf08a6dbd
6 changed files with 9 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ export const formatShortcutLabelForSR = (
controlLabel,
commandLabel,
altLabel,
optionLabel,
shiftLabel,
plusLabel,
noShortcutLabel,
@@ -28,6 +29,7 @@ export const formatShortcutLabelForSR = (
controlLabel: string
commandLabel: string
altLabel: string
optionLabel: string
shiftLabel: string
plusLabel: string
noShortcutLabel: string
@@ -37,9 +39,10 @@ export const formatShortcutLabelForSR = (
const key = shortcut.key?.toUpperCase()
if (!key) return noShortcutLabel
const ctrlWord = isMacintosh() ? commandLabel : controlLabel
const altWord = isMacintosh() ? optionLabel : altLabel
const parts: string[] = []
if (shortcut.ctrlKey) parts.push(ctrlWord)
if (shortcut.altKey) parts.push(altLabel)
if (shortcut.altKey) parts.push(altWord)
if (shortcut.shiftKey) parts.push(shiftLabel)
parts.push(key)
return parts.join(` ${plusLabel} `)

View File

@@ -38,6 +38,7 @@ export const useShortcutFormatting = () => {
controlLabel: t('shortcutsPanel.sr.control'),
commandLabel: t('shortcutsPanel.sr.command'),
altLabel: t('shortcutsPanel.sr.alt'),
optionLabel: t('shortcutsPanel.sr.option'),
shiftLabel: t('shortcutsPanel.sr.shift'),
plusLabel: t('shortcutsPanel.sr.plus'),
noShortcutLabel: t('shortcutsPanel.sr.noShortcut'),

View File

@@ -620,6 +620,7 @@
"control": "Steuerung",
"command": "Befehl",
"alt": "Alt",
"option": "Option",
"shift": "Umschalt",
"plus": "plus",
"hold": "Halte {{key}} gedrückt",

View File

@@ -620,6 +620,7 @@
"control": "Control",
"command": "Command",
"alt": "Alt",
"option": "Option",
"shift": "Shift",
"plus": "plus",
"hold": "Hold {{key}}",

View File

@@ -620,6 +620,7 @@
"control": "Contrôle",
"command": "Commande",
"alt": "Alt",
"option": "Option",
"shift": "Majuscule",
"plus": "plus",
"hold": "Maintenir {{key}}",

View File

@@ -620,6 +620,7 @@
"control": "Control",
"command": "Command",
"alt": "Alt",
"option": "Option",
"shift": "Shift",
"plus": "plus",
"hold": "Houd {{key}} ingedrukt",