2020-09-13 18:21:11 +02:00
|
|
|
import CommandService from 'lib/services/CommandService';
|
2020-10-09 19:35:46 +02:00
|
|
|
import shim from 'lib/shim';
|
2020-09-06 14:00:25 +02:00
|
|
|
|
2020-10-09 19:35:46 +02:00
|
|
|
import { _ } from 'lib/locale';
|
2020-09-06 14:00:25 +02:00
|
|
|
|
|
|
|
const commandService = CommandService.instance();
|
|
|
|
|
|
|
|
const getLabel = (commandName: string) => {
|
2020-09-13 18:21:11 +02:00
|
|
|
if (commandService.exists(commandName)) return commandService.label(commandName, true);
|
2020-09-06 14:00:25 +02:00
|
|
|
|
|
|
|
// 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;
|