Localize keyboard button texts

(see #4090)
This commit is contained in:
Bryan Housel
2017-06-06 16:55:59 -04:00
parent 1341c80664
commit c22fa60b8a
4 changed files with 58 additions and 17 deletions

View File

@@ -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:

View File

@@ -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": ["⌥"],

23
dist/locales/en.json vendored
View File

@@ -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": {

View File

@@ -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;