文件
mynode/packages/app-desktop/gui/KeymapConfig/utils/getLabel.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

40 行
1.2 KiB
TypeScript

import CommandService from '@joplin/lib/services/CommandService';
import shim from '@joplin/lib/shim';
import { _ } from '@joplin/lib/locale';
const commandService = CommandService.instance();
const getLabel = (commandName: string): 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 'zoomActualSize':
return _('Actual Size');
case 'help':
return _('Website and documentation');
case 'hideApp':
return _('Hide Joplin');
case 'minimizeWindow':
return _('Minimise');
case 'closeWindow':
return _('Close Window');
case 'config':
return shim.isMac() ? _('Preferences') : _('Options');
}
// We don't throw an error if a command is not found because if for
// example a command is removed from one version to the next, or a
// command is renamed, we still want the keymap editor to work. So in
// that case, we simply display the command name and it is up to the
// user to fix the shortcut if needed.
return `${commandName} (${_('Invalid')})`;
};
export default getLabel;