UX: Show translated modifier keys in editor shortcuts

This commit is contained in:
Gerhard Schlager 2015-11-13 22:43:34 +01:00
parent 5234e54f7e
commit a00c373b6f
2 changed files with 18 additions and 5 deletions

View File

@ -119,16 +119,24 @@ Toolbar.prototype.addButton = function(button) {
if (button.shortcut) {
const mac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
const mod = mac ? 'Meta' : 'Ctrl';
createdButton.title = `${title} (${mod}+${button.shortcut})`;
var shortcutTitle = `${mod}+${button.shortcut}`;
// Mac users are used to glyphs for shortcut keys
if (mac) {
createdButton.title = createdButton.title.replace('Shift', "\u21E7")
.replace('Meta', "\u2318")
.replace('Alt', "\u2325")
.replace(/\+/g, '');
shortcutTitle = shortcutTitle
.replace('Shift', "\u21E7")
.replace('Meta', "\u2318")
.replace('Alt', "\u2325")
.replace(/\+/g, '');
} else {
shortcutTitle = shortcutTitle
.replace('Shift', I18n.t('shortcut_modifier_key.shift'))
.replace('Ctrl', I18n.t('shortcut_modifier_key.ctrl'))
.replace('Alt', I18n.t('shortcut_modifier_key.alt'));
}
createdButton.title = `${title} (${shortcutTitle})`;
this.shortcuts[`${mod}+${button.shortcut}`.toLowerCase()] = createdButton;
} else {
createdButton.title = title;

View File

@ -829,6 +829,11 @@ en:
twitter: "Twitter"
emoji_one: "Emoji One"
shortcut_modifier_key:
shift: 'Shift'
ctrl: 'Ctrl'
alt: 'Alt'
composer:
emoji: "Emoji :smile:"
more_emoji: "more..."