1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/ElectronClient/gui/KeymapConfig/utils/getLabel.ts

37 lines
971 B
TypeScript
Raw Normal View History

import CommandService from 'lib/services/CommandService';
import shim from 'lib/shim';
import { _ } from 'lib/locale';
const commandService = CommandService.instance();
const getLabel = (commandName: string) => {
if (commandService.exists(commandName)) return commandService.label(commandName, true);
// Some commands are not registered in CommandService at the moment
// Following hard-coded labels are used as a workaround
switch (commandName) {
case 'quit':
return _('Quit');
case 'insertTemplate':
return _('Insert template');
case 'zoomActualSize':
return _('Actual Size');
case 'gotoAnything':
return _('Goto Anything...');
case 'help':
return _('Website and documentation');
case 'hideApp':
return _('Hide Joplin');
case 'closeWindow':
return _('Close Window');
case 'config':
return shim.isMac() ? _('Preferences') : _('Options');
default:
throw new Error(`Command: ${commandName} is unknown`);
}
};
export default getLabel;