mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:43:44 +08:00
UX: Show translated modifier keys in editor shortcuts
This commit is contained in:
parent
5234e54f7e
commit
a00c373b6f
|
@ -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")
|
||||
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;
|
||||
|
|
|
@ -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..."
|
||||
|
|
Loading…
Reference in New Issue
Block a user