translation-commands

This commit is contained in:
Stela Augustinova
2025-11-10 16:14:32 +01:00
parent 9ee0b32cac
commit 167aaa8491
25 changed files with 688 additions and 249 deletions

View File

@@ -70,42 +70,42 @@ import { __t } from '../translations';
registerCommand({
id: 'theme.changeTheme',
category: 'Theme',
name: 'Change',
toolbarName: 'Change theme',
category: __t('command.theme', { defaultMessage: 'Theme' }),
name: __t('command.theme.change', { defaultMessage: 'Change' }),
toolbarName: __t('command.theme.changeToolbar', { defaultMessage: 'Change theme' }),
onClick: () => showModal(SettingsModal, { selectedTab: 'theme' }),
// getSubCommands: () => get(extensions).themes.map(themeCommand),
});
registerCommand({
id: 'toolbar.show',
category: 'Toolbar',
name: 'Show',
category: __t('command.toolbar', { defaultMessage: 'Toolbar' }),
name: __t('command.toolbar.show', { defaultMessage: 'Show' }),
onClick: () => visibleToolbar.set(true),
testEnabled: () => !getVisibleToolbar(),
});
registerCommand({
id: 'toolbar.hide',
category: 'Toolbar',
name: 'Hide',
category: __t('command.toolbar', { defaultMessage: 'Toolbar' }),
name: __t('command.toolbar.hide', { defaultMessage: 'Hide' }),
onClick: () => visibleToolbar.set(false),
testEnabled: () => getVisibleToolbar(),
});
registerCommand({
id: 'about.show',
category: 'About',
name: 'Show',
toolbarName: 'About',
category: __t('command.about', { defaultMessage: 'About' }),
name: __t('command.about.show', { defaultMessage: 'Show' }),
toolbarName: __t('command.about.toolbar', { defaultMessage: 'About' }),
onClick: () => showModal(AboutModal),
});
registerCommand({
id: 'toggle.sidebar',
category: 'Sidebar',
name: 'Show',
toolbarName: 'Toggle sidebar',
category: __t('command.sidebar', { defaultMessage: 'Sidebar' }),
name: __t('command.sidebar.show', { defaultMessage: 'Show' }),
toolbarName: __t('command.sidebar.toggleToolbar', { defaultMessage: 'Toggle sidebar' }),
keyText: 'CtrlOrCommand+B',
onClick: () => visibleWidgetSideBar.update(x => !x),
});
@@ -114,10 +114,10 @@ registerCommand({
id: 'new.connection',
toolbar: true,
icon: 'icon new-connection',
toolbarName: 'Add connection',
category: 'New',
toolbarName: __t('command.new.connection', { defaultMessage: 'Add connection' }),
category: __t('command.new', { defaultMessage: 'New'}),
toolbarOrder: 1,
name: 'Connection',
name: __t('command.new.connection', { defaultMessage: 'Connection' }),
testEnabled: () => !getCurrentConfig()?.runAsPortal && !getCurrentConfig()?.storageDatabase,
onClick: () => {
openNewTab({
@@ -132,10 +132,10 @@ registerCommand({
id: 'new.connectionOnCloud',
toolbar: true,
icon: 'img cloud-connection',
toolbarName: 'Add connection',
category: 'New',
toolbarName: __t('command.new.connection', { defaultMessage: 'Add connection' }),
category: __t('command.new', { defaultMessage: 'New' }),
toolbarOrder: 1,
name: 'Connection on Cloud',
name: __t('command.new.connectionCloud', { defaultMessage: 'Connection on Cloud' }),
testEnabled: () =>
!getCurrentConfig()?.runAsPortal && !getCurrentConfig()?.storageDatabase && !!getCloudSigninTokenHolder(),
onClick: () => {
@@ -154,10 +154,10 @@ registerCommand({
id: 'new.connection.folder',
toolbar: true,
icon: 'icon add-folder',
toolbarName: 'Add connection folder',
category: 'New',
toolbarName: __t('command.new.connectionFolderToolbar', { defaultMessage: 'Add connection folder' }),
category: __t('command.new', { defaultMessage: 'New' }),
toolbarOrder: 1,
name: 'Connection folder',
name: __t('command.new.connectionFolder', { defaultMessage: 'Connection folder' }),
testEnabled: () => !getCurrentConfig()?.runAsPortal,
onClick: () => {
showModal(InputTextModal, {
@@ -177,21 +177,21 @@ registerCommand({
registerCommand({
id: 'new.query',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'icon file',
toolbar: true,
toolbarOrder: 2,
name: 'Query',
toolbarName: 'New query',
name: __t('command.new.query', { defaultMessage: 'Query' }),
toolbarName: __t('command.new.queryToolbar', { defaultMessage: 'New query' }),
keyText: 'CtrlOrCommand+T',
onClick: () => newQuery(),
});
registerCommand({
id: 'new.shell',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img shell',
name: 'JavaScript Shell',
name: __t('command.new.shell', { defaultMessage: 'JavaScript Shell' }),
menuName: 'New JavaScript shell',
onClick: () => {
openNewTab({
@@ -205,9 +205,9 @@ registerCommand({
if (isProApp()) {
registerCommand({
id: 'new.queryDesign',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img query-design',
name: 'Query design',
name: __t('command.new.queryDesign', { defaultMessage: 'Query design' }),
menuName: 'New query design',
onClick: () => newQueryDesign(),
testEnabled: () =>
@@ -219,9 +219,9 @@ if (isProApp()) {
if (isProApp()) {
registerCommand({
id: 'new.modelTransform',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img transform',
name: 'Model transform',
name: __t('command.new.modelTransform', { defaultMessage: 'Model transform' }),
menuName: 'New model transform',
onClick: () => {
openNewTab(
@@ -263,9 +263,9 @@ if (isProApp()) {
if (isProApp()) {
registerCommand({
id: 'new.perspective',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img perspective',
name: 'Perspective',
name: __t('command.new.perspective', { defaultMessage: 'Perspective' }),
menuName: 'New perspective',
onClick: () => newPerspective(),
});
@@ -274,9 +274,9 @@ if (isProApp()) {
if (isProApp()) {
registerCommand({
id: 'new.application',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img app',
name: 'Application',
name: __t('command.new.application', { defaultMessage: 'Application' }),
menuName: 'New application',
onClick: () => {
openNewTab({
@@ -290,9 +290,9 @@ if (isProApp()) {
registerCommand({
id: 'new.diagram',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img diagram',
name: 'ER Diagram',
name: __t('command.new.diagram', { defaultMessage: 'ER Diagram' }),
menuName: 'New ER diagram',
testEnabled: () =>
getCurrentDatabase() &&
@@ -302,9 +302,9 @@ registerCommand({
registerCommand({
id: 'new.archiveFolder',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img archive',
name: 'Archive folder',
name: __t('command.new.archiveFolder', { defaultMessage: 'Archive folder' }),
onClick: () => {
showModal(InputTextModal, {
value: '',
@@ -336,11 +336,11 @@ registerCommand({
registerCommand({
id: 'new.table',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'icon table',
name: 'Table',
name: __t('command.new.table', { defaultMessage: 'Table' }),
toolbar: true,
toolbarName: 'New table',
toolbarName: __t('command.new.tableToolbar', { defaultMessage: 'New table' }),
testEnabled: () => {
if (!hasPermission('dbops/model/edit')) return false;
const driver = findEngineDriver(get(currentDatabase)?.connection, getExtensions());
@@ -356,9 +356,9 @@ registerCommand({
registerCommand({
id: 'new.collection',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'icon table',
name: 'Collection',
name: __t('command.new.collection', { defaultMessage: 'Collection' }),
toolbar: true,
toolbarName: __t('command.new.collectionToolbar', { defaultMessage: 'New collection/container' }),
testEnabled: () => {
@@ -382,9 +382,9 @@ registerCommand({
registerCommand({
id: 'new.markdown',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img markdown',
name: 'Markdown page',
name: __t('command.new.markdown', { defaultMessage: 'Markdown page' }),
onClick: () => {
openNewTab({
title: 'Page #',
@@ -397,9 +397,9 @@ registerCommand({
if (isProApp()) {
registerCommand({
id: 'new.modelCompare',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'icon compare',
name: 'Compare DB',
name: __t('command.new.modelCompare', { defaultMessage: 'Compare DB' }),
toolbar: true,
onClick: () => {
openNewTab({
@@ -413,9 +413,9 @@ if (isProApp()) {
registerCommand({
id: 'new.jsonl',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img archive',
name: 'JSON Lines',
name: __t('command.new.jsonl', { defaultMessage: 'JSON Lines' }),
menuName: 'New JSON lines file',
onClick: () => {
openNewTab(
@@ -433,9 +433,9 @@ registerCommand({
registerCommand({
id: 'new.sqliteDatabase',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img sqlite-database',
name: 'SQLite database',
name: __t('command.new.sqliteDatabase', { defaultMessage: 'SQLite database' }),
menuName: _t('command.new.sqliteDatabase', { defaultMessage: 'New SQLite database' }),
onClick: () => {
showModal(InputTextModal, {
@@ -453,9 +453,9 @@ registerCommand({
registerCommand({
id: 'new.duckdbDatabase',
category: 'New',
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img sqlite-database',
name: 'DuckDB database',
name: __t('command.new.duckdbDatabase', { defaultMessage: 'DuckDB database' }),
menuName: _t('command.new.duckdbDatabase', { defaultMessage: 'New DuckDB database' }),
onClick: () => {
showModal(InputTextModal, {
@@ -473,8 +473,8 @@ registerCommand({
registerCommand({
id: 'tabs.changelog',
category: 'Tabs',
name: 'Changelog',
category: __t('command.tabs', { defaultMessage: 'Tabs' }),
name: __t('command.tabs.changelog', { defaultMessage: 'Changelog' }),
onClick: () => {
openNewTab({
title: 'ChangeLog',
@@ -489,7 +489,7 @@ registerCommand({
id: 'group.save',
category: null,
isGroupCommand: true,
name: 'Save',
name: __t('command.save', { defaultMessage: 'Save' }),
keyText: 'CtrlOrCommand+S',
group: 'save',
});
@@ -498,7 +498,7 @@ registerCommand({
id: 'group.saveAs',
category: null,
isGroupCommand: true,
name: 'Save As',
name: __t('command.saveAs', { defaultMessage: 'Save As' }),
keyText: 'CtrlOrCommand+Shift+S',
group: 'saveAs',
});
@@ -507,7 +507,7 @@ registerCommand({
id: 'group.undo',
category: null,
isGroupCommand: true,
name: 'Undo',
name: __t('command.undo', { defaultMessage: 'Undo' }),
keyText: 'CtrlOrCommand+Z',
group: 'undo',
});
@@ -516,15 +516,15 @@ registerCommand({
id: 'group.redo',
category: null,
isGroupCommand: true,
name: 'Redo',
name: __t('command.redo', { defaultMessage: 'Redo' }),
keyText: 'CtrlOrCommand+Y',
group: 'redo',
});
registerCommand({
id: 'file.open',
category: 'File',
name: 'Open',
category: __t('command.file', { defaultMessage: 'File' }),
name: __t('command.file.open', { defaultMessage: 'Open' }),
keyText: 'CtrlOrCommand+O',
testEnabled: () => getElectron() != null,
onClick: openElectronFile,
@@ -532,36 +532,36 @@ registerCommand({
registerCommand({
id: 'file.openArchive',
category: 'File',
name: 'Open DB Model/Archive',
category: __t('command.file', { defaultMessage: 'File' }),
name: __t('command.file.openArchive', { defaultMessage: 'Open DB Model/Archive' }),
testEnabled: () => getElectron() != null,
onClick: openArchiveFolder,
});
registerCommand({
id: 'folder.showLogs',
category: 'Folder',
name: 'Open logs',
category: __t('command.folder', { defaultMessage: 'Folder' }),
name: __t('command.folder.openLogs', { defaultMessage: 'Open logs' }),
testEnabled: () => getElectron() != null,
onClick: () => electron.showItemInFolder(getCurrentConfig().logsFilePath),
});
registerCommand({
id: 'folder.showData',
category: 'Folder',
name: 'Open data folder',
category: __t('command.folder', { defaultMessage: 'Folder' }),
name: __t('command.folder.openData', { defaultMessage: 'Open data folder' }),
testEnabled: () => getElectron() != null,
onClick: () => electron.showItemInFolder(getCurrentConfig().connectionsFilePath),
});
registerCommand({
id: 'app.resetSettings',
category: 'File',
name: 'Reset layout data & settings',
category: __t('command.file', { defaultMessage: 'File' }),
name: __t('command.file.resetLayout', { defaultMessage: 'Reset layout data & settings' }),
testEnabled: () => true,
onClick: () => {
showModal(ConfirmModal, {
message: `Really reset layout data? All opened tabs, settings and layout data will be lost. Connections and saved files will be preserved. After this, restart DbGate for applying changes.`,
message: _t('command.file.resetLayoutConfirm', { defaultMessage: 'Really reset layout data? All opened tabs, settings and layout data will be lost. Connections and saved files will be preserved. After this, restart DbGate for applying changes.' }),
onConfirm: async () => {
await apiCall('config/delete-settings');
localStorage.clear();
@@ -578,8 +578,8 @@ registerCommand({
registerCommand({
id: 'app.exportConnections',
category: 'Settings',
name: 'Export connections',
category: __t('command.settings', { defaultMessage: 'Settings' }),
name: __t('command.settings.exportConnections', { defaultMessage: 'Export connections' }),
testEnabled: () => !getCurrentConfig()?.runAsPortal && !getCurrentConfig()?.storageDatabase,
onClick: () => {
showModal(ExportImportConnectionsModal, {
@@ -590,8 +590,8 @@ registerCommand({
registerCommand({
id: 'app.importConnections',
category: 'Settings',
name: 'Import connections',
category: __t('command.settings', { defaultMessage: 'Settings' }),
name: __t('command.settings.importConnections', { defaultMessage: 'Import connections' }),
testEnabled: () => !getCurrentConfig()?.runAsPortal && !getCurrentConfig()?.storageDatabase,
onClick: async () => {
const files = await electron.showOpenDialog({
@@ -616,8 +616,8 @@ registerCommand({
registerCommand({
id: 'file.import',
category: 'File',
name: 'Import data',
category: __t('command.file', { defaultMessage: 'File' }),
name: __t('command.file.import', { defaultMessage: 'Import data' }),
toolbar: true,
icon: 'icon import',
onClick: () =>
@@ -637,8 +637,8 @@ registerCommand({
registerCommand({
id: 'view.reset',
category: 'View',
name: 'Reset view',
category: __t('command.view', { defaultMessage: 'View' }),
name: __t('command.view.reset', { defaultMessage: 'Reset view' }),
onClick: () => {
const keys = [
'leftPanelWidth',
@@ -665,14 +665,14 @@ registerCommand({
'currentArchive',
];
for (const key of keys) removeLocalStorage(key);
showSnackbarSuccess('Restart DbGate (or reload on web) for applying changes');
showSnackbarSuccess(_t('command.view.restart', { defaultMessage: 'Restart DbGate (or reload on web) for applying changes' }));
},
});
registerCommand({
id: 'sql.generator',
category: 'SQL',
name: 'SQL Generator',
category: __t('command.sql', { defaultMessage: 'SQL' }),
name: __t('command.sql.generator', { defaultMessage: 'SQL Generator' }),
toolbar: true,
icon: 'icon sql-generator',
testEnabled: () =>
@@ -688,8 +688,8 @@ registerCommand({
registerCommand({
id: 'database.export',
category: 'Database',
name: 'Export database',
category: __t('command.database', { defaultMessage: 'Database' }),
name: __t('command.database.export', { defaultMessage: 'Export database' }),
toolbar: true,
icon: 'icon export',
testEnabled: () => getCurrentDatabase() != null && hasPermission(`dbops/export`) && isProApp(),
@@ -706,8 +706,8 @@ registerCommand({
if (isProApp()) {
registerCommand({
id: 'database.compare',
category: 'Database',
name: 'Compare databases',
category: __t('command.database', { defaultMessage: 'Database' }),
name: __t('command.database.compare', { defaultMessage: 'Compare databases' }),
toolbar: true,
icon: 'icon compare',
testEnabled: () =>
@@ -739,8 +739,8 @@ if (isProApp()) {
registerCommand({
id: 'database.chat',
category: 'Database',
name: 'Database chat',
category: __t('command.database', { defaultMessage: 'Database' }),
name: __t('command.database.chat', { defaultMessage: 'Database chat' }),
toolbar: true,
icon: 'icon ai',
testEnabled: () =>
@@ -764,11 +764,11 @@ if (isProApp()) {
if (hasPermission('settings/change')) {
registerCommand({
id: 'settings.commands',
category: 'Settings',
name: 'Keyboard shortcuts',
category: __t('command.settings', { defaultMessage: 'Settings' }),
name: __t('command.settings.shortcuts', { defaultMessage: 'Keyboard shortcuts' }),
onClick: () => {
openNewTab({
title: 'Keyboard Shortcuts',
title: __t('command.settings.shortcuts', { defaultMessage: 'Keyboard shortcuts' }),
icon: 'icon keyboard',
tabComponent: 'CommandListTab',
props: {},
@@ -779,9 +779,9 @@ if (hasPermission('settings/change')) {
registerCommand({
id: 'settings.show',
category: 'Settings',
name: 'Change',
toolbarName: 'Settings',
category: __t('command.settings', { defaultMessage: 'Settings' }),
name: __t('command.settings.change', { defaultMessage: 'Change' }),
toolbarName: __t('command.settings', { defaultMessage: 'Settings' }),
onClick: () => showModal(SettingsModal),
testEnabled: () => hasPermission('settings/change'),
});
@@ -789,8 +789,8 @@ if (hasPermission('settings/change')) {
registerCommand({
id: 'cloud.logout',
category: 'Cloud',
name: 'Logout',
category: __t('command.cloud', { defaultMessage: 'Cloud' }),
name: __t('command.cloud.logout', { defaultMessage: 'Logout' }),
onClick: () => {
cloudSigninTokenHolder.set(null);
},
@@ -798,8 +798,8 @@ registerCommand({
registerCommand({
id: 'file.exit',
category: 'File',
name: isMac() ? 'Quit' : 'Exit',
category: __t('command.file', { defaultMessage: 'File' }),
name: isMac() ? __t('command.file.quit', { defaultMessage: 'Quit' }) : __t('command.file.exit', { defaultMessage: 'Exit' }),
// keyText: isMac() ? 'Command+Q' : null,
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('quit-app'),
@@ -807,16 +807,16 @@ registerCommand({
registerCommand({
id: 'app.logout',
category: 'App',
name: 'Logout',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.app.logout', { defaultMessage: 'Logout' }),
testEnabled: () => getCurrentConfig()?.isUserLoggedIn,
onClick: doLogout,
});
registerCommand({
id: 'app.loggedUserCommands',
category: 'App',
name: 'Logged user',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.app.loggedUser', { defaultMessage: 'Logged user' }),
getSubCommands: () => {
const config = getCurrentConfig();
if (!config) return [];
@@ -833,16 +833,16 @@ registerCommand({
registerCommand({
id: 'app.disconnect',
category: 'App',
name: 'Disconnect',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.app.disconnect', { defaultMessage: 'Disconnect' }),
testEnabled: () => getCurrentConfig()?.singleConnection != null && !getCurrentConfig()?.isUserLoggedIn,
onClick: () => disconnectServerConnection(getCurrentConfig()?.singleConnection?._id),
});
registerCommand({
id: 'file.checkForUpdates',
category: 'App',
name: 'Check for updates',
id: 'app.checkForUpdates',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.app.checkForUpdates', { defaultMessage: 'Check for updates' }),
// testEnabled: () => true,
testEnabled: () => getAppUpdaterActive(),
onClick: () => getElectron().send('check-for-updates'),
@@ -868,7 +868,7 @@ export function registerFileCommands({
id: idPrefix + '.save',
group: 'save',
category,
name: 'Save',
name: __t('command.save', { defaultMessage: 'Save' }),
// keyText: 'CtrlOrCommand+S',
icon: 'icon save',
toolbar: true,
@@ -880,14 +880,14 @@ export function registerFileCommands({
id: idPrefix + '.saveAs',
group: 'saveAs',
category,
name: 'Save As',
name: __t('command.saveAs', { defaultMessage: 'Save As' }),
testEnabled: () => getCurrentEditor() != null,
onClick: () => saveTabFile(getCurrentEditor(), 'save-as', folder, format, fileExtension),
});
registerCommand({
id: idPrefix + '.saveToDisk',
category,
name: 'Save to disk',
name: __t('command.saveToDisk', { defaultMessage: 'Save to disk' }),
testEnabled: () => getCurrentEditor() != null && getElectron() != null,
onClick: () => saveTabFile(getCurrentEditor(), 'save-to-disk', folder, format, fileExtension),
});
@@ -897,7 +897,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.execute',
category,
name: 'Execute',
name: __t('command.execute', { defaultMessage: 'Execute' }),
icon: 'icon run',
toolbar: true,
isRelatedToTab: true,
@@ -911,7 +911,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.kill',
category,
name: 'Kill',
name: __t('command.kill', { defaultMessage: 'Kill' }),
icon: 'icon close',
toolbar: true,
isRelatedToTab: true,
@@ -924,7 +924,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.toggleComment',
category,
name: 'Toggle comment',
name: __t('command.toggleComment', { defaultMessage: 'Toggle comment' }),
keyText: 'CtrlOrCommand+/',
disableHandleKeyText: 'CtrlOrCommand+/',
testEnabled: () => getCurrentEditor() != null,
@@ -936,7 +936,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.copy',
category,
name: 'Copy',
name: __t('command.copy', { defaultMessage: 'Copy' }),
disableHandleKeyText: 'CtrlOrCommand+C',
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().copy(),
@@ -944,7 +944,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.paste',
category,
name: 'Paste',
name: __t('command.paste', { defaultMessage: 'Paste' }),
disableHandleKeyText: 'CtrlOrCommand+V',
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().paste(),
@@ -955,7 +955,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.find',
category,
name: 'Find',
name: __t('command.find', { defaultMessage: 'Find' }),
keyText: 'CtrlOrCommand+F',
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().find(),
@@ -964,7 +964,7 @@ export function registerFileCommands({
id: idPrefix + '.replace',
category,
keyText: isMac() ? 'Alt+Command+F' : 'CtrlOrCommand+H',
name: 'Replace',
name: __t('command.replace', { defaultMessage: 'Replace' }),
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().replace(),
});
@@ -973,7 +973,7 @@ export function registerFileCommands({
registerCommand({
id: idPrefix + '.undo',
category,
name: 'Undo',
name: __t('command.undo', { defaultMessage: 'Undo' }),
group: 'undo',
icon: 'icon undo',
testEnabled: () => getCurrentEditor()?.canUndo(),
@@ -983,7 +983,7 @@ export function registerFileCommands({
id: idPrefix + '.redo',
category,
group: 'redo',
name: 'Redo',
name: __t('command.redo', { defaultMessage: 'Redo' }),
icon: 'icon redo',
testEnabled: () => getCurrentEditor()?.canRedo(),
onClick: () => getCurrentEditor().redo(),
@@ -993,24 +993,24 @@ export function registerFileCommands({
registerCommand({
id: 'app.minimize',
category: 'Application',
name: 'Minimize',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.minimize', { defaultMessage: 'Minimize' }),
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'minimize'),
});
registerCommand({
id: 'app.maximize',
category: 'Application',
name: 'Maximize',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.maximize', { defaultMessage: 'Maximize' }),
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'maximize'),
});
registerCommand({
id: 'app.toggleFullScreen',
category: 'Application',
name: 'Toggle full screen',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.toggleFullScreen', { defaultMessage: 'Toggle full screen' }),
keyText: 'F11',
testEnabled: () => getElectron() != null,
onClick: async () => {
@@ -1024,45 +1024,45 @@ registerCommand({
registerCommand({
id: 'app.toggleDevTools',
category: 'Application',
name: 'Toggle Dev Tools',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.toggleDevTools', { defaultMessage: 'Toggle Dev Tools' }),
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'devtools'),
});
registerCommand({
id: 'app.reload',
category: 'Application',
name: 'Reload',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.reload', { defaultMessage: 'Reload' }),
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'reload'),
});
registerCommand({
id: 'app.openDocs',
category: 'Application',
name: 'Documentation',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.documentation', { defaultMessage: 'Documentation' }),
onClick: () => openWebLink('https://docs.dbgate.io/'),
});
registerCommand({
id: 'app.openWeb',
category: 'Application',
name: 'DbGate web',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.web', { defaultMessage: 'DbGate web' }),
onClick: () => openWebLink('https://www.dbgate.io/'),
});
registerCommand({
id: 'app.openIssue',
category: 'Application',
name: 'Report problem or feature request',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.openIssue', { defaultMessage: 'Report problem or feature request' }),
onClick: () => openWebLink('https://github.com/dbgate/dbgate/issues/new'),
});
registerCommand({
id: 'app.openSponsoring',
category: 'Application',
name: 'Become sponsor',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.becomeSponsor', { defaultMessage: 'Become sponsor' }),
testEnabled: () => !isProApp(),
onClick: () => openWebLink('https://opencollective.com/dbgate'),
});
@@ -1076,8 +1076,8 @@ registerCommand({
registerCommand({
id: 'app.zoomIn',
category: 'Application',
name: 'Zoom in',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.zoomIn', { defaultMessage: 'Zoom in' }),
keyText: 'CtrlOrCommand+=',
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'zoomin'),
@@ -1085,8 +1085,8 @@ registerCommand({
registerCommand({
id: 'app.zoomOut',
category: 'Application',
name: 'Zoom out',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.zoomOut', { defaultMessage: 'Zoom out' }),
keyText: 'CtrlOrCommand+-',
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'zoomout'),
@@ -1094,16 +1094,16 @@ registerCommand({
registerCommand({
id: 'app.zoomReset',
category: 'Application',
name: 'Reset zoom',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.zoomReset', { defaultMessage: 'Reset zoom' }),
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'zoomreset'),
});
registerCommand({
id: 'edit.undo',
category: 'Edit',
name: 'Undo',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.undo', { defaultMessage: 'Undo' }),
keyText: 'CtrlOrCommand+Z',
systemCommand: true,
testEnabled: () => getElectron() != null,
@@ -1112,8 +1112,8 @@ registerCommand({
registerCommand({
id: 'edit.redo',
category: 'Edit',
name: 'Redo',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.redo', { defaultMessage: 'Redo' }),
systemCommand: true,
testEnabled: () => getElectron() != null,
onClick: () => getElectron().send('window-action', 'redo'),
@@ -1121,8 +1121,8 @@ registerCommand({
registerCommand({
id: 'edit.cut',
category: 'Edit',
name: 'Cut',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.cut', { defaultMessage: 'Cut' }),
keyText: 'CtrlOrCommand+X',
systemCommand: true,
testEnabled: () => getElectron() != null,
@@ -1131,8 +1131,8 @@ registerCommand({
registerCommand({
id: 'edit.copy',
category: 'Edit',
name: 'Copy',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.copy', { defaultMessage: 'Copy' }),
keyText: 'CtrlOrCommand+C',
systemCommand: true,
testEnabled: () => getElectron() != null,
@@ -1141,8 +1141,8 @@ registerCommand({
registerCommand({
id: 'edit.paste',
category: 'Edit',
name: 'Paste',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.paste', { defaultMessage: 'Paste' }),
keyText: 'CtrlOrCommand+V',
systemCommand: true,
testEnabled: () => getElectron() != null,
@@ -1151,8 +1151,8 @@ registerCommand({
registerCommand({
id: 'edit.selectAll',
category: 'Edit',
name: 'Select All',
category: __t('command.edit', { defaultMessage: 'Edit' }),
name: __t('command.edit.selectAll', { defaultMessage: 'Select All' }),
keyText: 'CtrlOrCommand+A',
systemCommand: true,
testEnabled: () => getElectron() != null,
@@ -1161,8 +1161,8 @@ registerCommand({
registerCommand({
id: 'app.unsetCurrentDatabase',
category: 'Application',
name: 'Unset current database',
category: __t('command.application', { defaultMessage: 'Application' }),
name: __t('command.application.unsetCurrentDatabase', { defaultMessage: 'Unset current database' }),
testEnabled: () => getCurrentDatabase() != null,
onClick: () => currentDatabase.set(null),
});
@@ -1171,8 +1171,8 @@ let loadedCampaignList = [];
registerCommand({
id: 'internal.loadCampaigns',
category: 'Internal',
name: 'Load campaign list',
category: __t('command.internal', { defaultMessage: 'Internal' }),
name: __t('command.internal.loadCampaigns', { defaultMessage: 'Load campaign list' }),
testEnabled: () => getBoolSettingsValue('internal.showCampaigns', false),
onClick: async () => {
const resp = await apiCall('cloud/promo-widget-list', {});
@@ -1182,8 +1182,8 @@ registerCommand({
registerCommand({
id: 'internal.showCampaigns',
category: 'Internal',
name: 'Show campaigns',
category: __t('command.internal', { defaultMessage: 'Internal' }),
name: __t('command.internal.showCampaigns', { defaultMessage: 'Show campaigns' }),
testEnabled: () => getBoolSettingsValue('internal.showCampaigns', false) && loadedCampaignList?.length > 0,
getSubCommands: () => {
return loadedCampaignList.map(campaign => ({