mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 02:06:01 +00:00
fixed main menu
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
function _t(key, { defaultMessage } = {}) {
|
function _t(key, { defaultMessage, currentTranslations } = {}) {
|
||||||
return global.TRANSLATION_DATA?.[key] || defaultMessage;
|
return (currentTranslations || global.TRANSLATION_DATA)?.[key] || defaultMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ({ editMenu, isMac }) => [
|
module.exports = ({ editMenu, isMac }, currentTranslations = null) => [
|
||||||
{
|
{
|
||||||
label: _t('menu.file', { defaultMessage: 'File' }),
|
label: _t('menu.file', { defaultMessage: 'File', currentTranslations }),
|
||||||
submenu: [
|
submenu: [
|
||||||
{ command: 'new.connection', hideDisabled: true },
|
{ command: 'new.connection', hideDisabled: true },
|
||||||
{ command: 'new.sqliteDatabase', hideDisabled: true },
|
{ command: 'new.sqliteDatabase', hideDisabled: true },
|
||||||
@@ -32,7 +32,7 @@ module.exports = ({ editMenu, isMac }) => [
|
|||||||
},
|
},
|
||||||
editMenu
|
editMenu
|
||||||
? {
|
? {
|
||||||
label: _t('menu.edit', { defaultMessage: 'Edit' }),
|
label: _t('menu.edit', { defaultMessage: 'Edit', currentTranslations }),
|
||||||
submenu: [
|
submenu: [
|
||||||
{ command: 'edit.undo' },
|
{ command: 'edit.undo' },
|
||||||
{ command: 'edit.redo' },
|
{ command: 'edit.redo' },
|
||||||
@@ -57,7 +57,7 @@ module.exports = ({ editMenu, isMac }) => [
|
|||||||
// ],
|
// ],
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
label: _t('menu.view', { defaultMessage: 'View' }),
|
label: _t('menu.view', { defaultMessage: 'View', currentTranslations }),
|
||||||
submenu: [
|
submenu: [
|
||||||
{ command: 'app.reload', hideDisabled: true },
|
{ command: 'app.reload', hideDisabled: true },
|
||||||
{ command: 'app.toggleDevTools', hideDisabled: true },
|
{ command: 'app.toggleDevTools', hideDisabled: true },
|
||||||
@@ -79,7 +79,7 @@ module.exports = ({ editMenu, isMac }) => [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: _t('menu.tools', { defaultMessage: 'Tools' }),
|
label: _t('menu.tools', { defaultMessage: 'Tools', currentTranslations }),
|
||||||
submenu: [
|
submenu: [
|
||||||
{ command: 'database.search', hideDisabled: true },
|
{ command: 'database.search', hideDisabled: true },
|
||||||
{ command: 'commandPalette.show', hideDisabled: true },
|
{ command: 'commandPalette.show', hideDisabled: true },
|
||||||
@@ -106,7 +106,7 @@ module.exports = ({ editMenu, isMac }) => [
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{
|
{
|
||||||
label: _t('menu.help', { defaultMessage: 'Help' }),
|
label: _t('menu.help', { defaultMessage: 'Help', currentTranslations }),
|
||||||
submenu: [
|
submenu: [
|
||||||
{ command: 'app.openDocs', hideDisabled: true },
|
{ command: 'app.openDocs', hideDisabled: true },
|
||||||
{ command: 'app.openWeb', hideDisabled: true },
|
{ command: 'app.openWeb', hideDisabled: true },
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
import NewObjectModal from '../modals/NewObjectModal.svelte';
|
import NewObjectModal from '../modals/NewObjectModal.svelte';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import { useConfig, usePromoWidget } from '../utility/metadataLoaders';
|
import { useConfig, usePromoWidget } from '../utility/metadataLoaders';
|
||||||
import { _t } from '../translations';
|
import { _t, getCurrentTranslations } from '../translations';
|
||||||
|
|
||||||
let domSettings;
|
let domSettings;
|
||||||
let domCloudAccount;
|
let domCloudAccount;
|
||||||
@@ -153,9 +153,8 @@
|
|||||||
const rect = domMainMenu.getBoundingClientRect();
|
const rect = domMainMenu.getBoundingClientRect();
|
||||||
const left = rect.right;
|
const left = rect.right;
|
||||||
const top = rect.top;
|
const top = rect.top;
|
||||||
const items = mainMenuDefinition({ editMenu: false });
|
const items = mainMenuDefinition({ editMenu: false }, getCurrentTranslations());
|
||||||
const copy = items.map(x => x && ({ ...x, label: x?.label ? _t(x.label.id, x.label.defaultMessage) : null }));
|
currentDropDownMenu.set({ left, top, items });
|
||||||
currentDropDownMenu.set({ left, top, items: copy });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleOpenCloudLogin() {
|
async function handleOpenCloudLogin() {
|
||||||
|
|||||||
Reference in New Issue
Block a user