diff --git a/data/core.yaml b/data/core.yaml index cfe14f751f..4413272aad 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1018,8 +1018,27 @@ en: start: "Start mapping!" shortcuts: title: "Keyboard shortcuts" + key: + alt: Alt + backspace: Backspace + cmd: Cmd + ctrl: Ctrl + delete: Delete + del: Del + end: End + enter: Enter + esc: Esc + home: Home + option: Option + pause: Pause + pgdn: PgDn + pgup: PgUp + return: Return + shift: Shift + space: Space + gesture: + drag: drag or: "-or-" - drag: drag browsing: title: "Browsing" navigation: diff --git a/data/shortcuts.json b/data/shortcuts.json index b6667c99b5..8eda5ac79c 100644 --- a/data/shortcuts.json +++ b/data/shortcuts.json @@ -79,7 +79,7 @@ }, { "modifiers": ["⇧"], "shortcuts": ["Left-click"], - "gesture": "shortcuts.drag", + "gesture": "shortcuts.gesture.drag", "text": "shortcuts.browsing.selecting.lasso" }, { "shortcuts": [], @@ -90,7 +90,7 @@ "section": "with_selected", "text": "shortcuts.browsing.with_selected.title" }, { - "shortcuts": ["Right-click", "Space"], + "shortcuts": ["Right-click", "shortcuts.key.space"], "text": "shortcuts.browsing.with_selected.edit_menu" }, { "modifiers": ["⌘"], @@ -114,7 +114,7 @@ "shortcuts": ["}", "⇟"], "text": "shortcuts.browsing.vertex_selected.last" }, { - "shortcuts": ["\\", "Pause"], + "shortcuts": ["\\", "shortcuts.key.pause"], "text": "shortcuts.browsing.vertex_selected.change_parent" } @@ -140,7 +140,7 @@ "shortcuts": ["3"], "text": "shortcuts.editing.drawing.add_area" }, { - "shortcuts": ["Space"], + "shortcuts": ["shortcuts.key.space"], "text": "shortcuts.editing.drawing.place_point" }, { "shortcuts": ["⌥"], diff --git a/dist/locales/en.json b/dist/locales/en.json index dacea399d8..da87f93816 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -885,8 +885,29 @@ }, "shortcuts": { "title": "Keyboard shortcuts", + "key": { + "alt": "Alt", + "backspace": "Backspace", + "cmd": "Cmd", + "ctrl": "Ctrl", + "delete": "Delete", + "del": "Del", + "end": "End", + "enter": "Enter", + "esc": "Esc", + "home": "Home", + "option": "Option", + "pause": "Pause", + "pgdn": "PgDn", + "pgup": "PgUp", + "return": "Return", + "shift": "Shift", + "space": "Space" + }, + "gesture": { + "drag": "drag" + }, "or": "-or-", - "drag": "drag", "browsing": { "title": "Browsing", "navigation": { diff --git a/modules/ui/cmd.js b/modules/ui/cmd.js index 125c06b919..2360d2f76c 100644 --- a/modules/ui/cmd.js +++ b/modules/ui/cmd.js @@ -1,3 +1,4 @@ +import { t } from '../util/locale'; import { utilDetect } from '../util/detect'; // Translate a MacOS key command into the appropriate Windows/Linux equivalent. @@ -41,17 +42,17 @@ uiCmd.display = function(code) { var detected = utilDetect(); var mac = (detected.os === 'mac'); var replacements = { - '⌘': mac ? '⌘ Cmd' : 'Ctrl', - '⇧': mac ? '⇧ Shift' : 'Shift', - '⌥': mac ? '⌥ Option' : 'Alt', - '⌫': mac ? '⌫ Delete' : 'Backspace', - '⌦': mac ? '⌦ Del' : 'Del', - '↖': mac ? '↖ PgUp' : 'PgUp', - '↘': mac ? '↘ PgDn' : 'PgDn', - '⇞': mac ? '⇞ Home' : 'Home', - '⇟': mac ? '⇟ End' : 'End', - '↵': mac ? '↵ Return' : 'Enter', - '⎋': mac ? '⎋ Esc' : 'Esc', + '⌘': mac ? '⌘ ' + t('shortcuts.key.cmd') : t('shortcuts.key.ctrl'), + '⇧': mac ? '⇧ ' + t('shortcuts.key.shift') : t('shortcuts.key.shift'), + '⌥': mac ? '⌥ ' + t('shortcuts.key.option') : t('shortcuts.key.alt'), + '⌫': mac ? '⌫ ' + t('shortcuts.key.delete') : t('shortcuts.key.backspace'), + '⌦': mac ? '⌦ ' + t('shortcuts.key.del') : t('shortcuts.key.del'), + '↖': mac ? '↖ ' + t('shortcuts.key.pgup') : t('shortcuts.key.pgup'), + '↘': mac ? '↘ ' + t('shortcuts.key.pgdn') : t('shortcuts.key.pgdn'), + '⇞': mac ? '⇞ ' + t('shortcuts.key.home') : t('shortcuts.key.home'), + '⇟': mac ? '⇟ ' + t('shortcuts.key.end') : t('shortcuts.key.end'), + '↵': mac ? '↵ ' + t('shortcuts.key.return') : t('shortcuts.key.enter'), + '⎋': mac ? '⎋ ' + t('shortcuts.key.esc') : t('shortcuts.key.esc'), }; return replacements[code] || code;