Merge pull request #1259 from dbgate/feature/electron-translation

Feature/electron translation
This commit is contained in:
Jan Prochazka
2025-11-18 14:02:43 +01:00
committed by GitHub
24 changed files with 232 additions and 86 deletions

View File

@@ -31,6 +31,16 @@ let mainModule;
let appUpdateStatus = '';
let settingsJson = {};
function getTranslated(key) {
if (typeof key === 'string' && global.TRANSLATION_DATA?.[key]) {
return global.TRANSLATION_DATA?.[key];
}
if (typeof key?._transKey === 'string') {
return global.TRANSLATION_DATA?.[key._transKey] ?? key._transOptions?.defaultMessage;
}
return key;
}
process.on('uncaughtException', function (error) {
console.error('uncaughtException', error);
});
@@ -63,6 +73,7 @@ try {
let mainWindow;
let mainMenu;
let runCommandOnLoad = null;
let mainWindowMenuSet = false;
log.transports.file.level = 'debug';
autoUpdater.logger = log;
@@ -91,9 +102,14 @@ function commandItem(item, disableAll = false) {
if (item.skipInApp) {
return { skip: true };
}
if (!command) {
return { skip: true };
}
return {
id,
label: command ? command.menuName || command.toolbarName || command.name : id,
label: command
? getTranslated(command.menuName) || getTranslated(command.toolbarName) || getTranslated(command.name)
: id,
accelerator: formatKeyText(command ? command.keyText : undefined),
enabled: command ? command.enabled && (!disableAll || command.systemCommand) : false,
click() {
@@ -155,11 +171,14 @@ ipcMain.on('update-commands', async (event, arg) => {
const command = commands[key];
// rebuild menu
if (menu.label != command.text || menu.accelerator != command.keyText) {
if (global.TRANSLATION_DATA && (menu.label != command.text || menu.accelerator != command.keyText)) {
mainMenu = buildMenu(isModalOpened || !!dbgatePage);
Menu.setApplicationMenu(mainMenu);
// mainWindow.setMenu(mainMenu);
if (!mainWindowMenuSet) {
mainWindow.setMenu(mainMenu);
mainWindowMenuSet = true;
}
return;
}
@@ -306,6 +325,12 @@ ipcMain.on('check-for-updates', async (event, url) => {
autoUpdater.autoDownload = false;
autoUpdater.checkForUpdates();
});
ipcMain.on('translation-data', async (event, arg) => {
global.TRANSLATION_DATA = JSON.parse(arg);
mainMenu = buildMenu();
Menu.setApplicationMenu(mainMenu);
mainWindow.setMenu(mainMenu);
});
function fillMissingSettings(value) {
const res = {
@@ -382,8 +407,8 @@ function createWindow() {
mainWindow.setFullScreen(true);
}
mainMenu = buildMenu();
mainWindow.setMenu(mainMenu);
// mainMenu = buildMenu();
// mainWindow.setMenu(mainMenu);
function loadMainWindow() {
const startUrl =

View File

@@ -1,6 +1,10 @@
module.exports = ({ editMenu, isMac }) => [
function _t(key, { defaultMessage, currentTranslations } = {}) {
return (currentTranslations || global.TRANSLATION_DATA)?.[key] || defaultMessage;
}
module.exports = ({ editMenu, isMac }, currentTranslations = null) => [
{
label: 'File',
label: _t('menu.file', { defaultMessage: 'File', currentTranslations }),
submenu: [
{ command: 'new.connection', hideDisabled: true },
{ command: 'new.sqliteDatabase', hideDisabled: true },
@@ -28,7 +32,7 @@ module.exports = ({ editMenu, isMac }) => [
},
editMenu
? {
label: 'Edit',
label: _t('menu.edit', { defaultMessage: 'Edit', currentTranslations }),
submenu: [
{ command: 'edit.undo' },
{ command: 'edit.redo' },
@@ -53,7 +57,7 @@ module.exports = ({ editMenu, isMac }) => [
// ],
// },
{
label: 'View',
label: _t('menu.view', { defaultMessage: 'View', currentTranslations }),
submenu: [
{ command: 'app.reload', hideDisabled: true },
{ command: 'app.toggleDevTools', hideDisabled: true },
@@ -75,7 +79,7 @@ module.exports = ({ editMenu, isMac }) => [
],
},
{
label: 'Tools',
label: _t('menu.tools', { defaultMessage: 'Tools', currentTranslations }),
submenu: [
{ command: 'database.search', hideDisabled: true },
{ command: 'commandPalette.show', hideDisabled: true },
@@ -102,7 +106,7 @@ module.exports = ({ editMenu, isMac }) => [
]
: []),
{
label: 'Help',
label: _t('menu.help', { defaultMessage: 'Help', currentTranslations }),
submenu: [
{ command: 'app.openDocs', hideDisabled: true },
{ command: 'app.openWeb', hideDisabled: true },

View File

@@ -27,7 +27,7 @@
import SettingsListener from './utility/SettingsListener.svelte';
import { handleAuthOnStartup } from './clientAuth';
import { initializeAppUpdates } from './utility/appUpdate';
import { _t, saveSelectedLanguageToCache } from './translations';
import { _t, getCurrentTranslations, saveSelectedLanguageToCache } from './translations';
import { installCloudListeners } from './utility/cloudListeners';
export let isAdminPage = false;
@@ -62,6 +62,12 @@
installCloudListeners();
refreshPublicCloudFiles();
saveSelectedLanguageToCache();
const electron = getElectron();
if (electron) {
electron.send('translation-data', JSON.stringify(getCurrentTranslations()));
global.TRANSLATION_DATA = getCurrentTranslations();
}
}
loadedApi = loadedApiValue;

View File

@@ -8,7 +8,7 @@
import Link from '../elements/Link.svelte';
import { focusedConnectionOrDatabase } from '../stores';
import { tick } from 'svelte';
import { _val } from '../translations';
import { _tval } from '../translations';
export let list;
export let module;
@@ -41,12 +41,12 @@
$: listTranslated = (list || []).map(data => ({
...data,
group: data?.group && _val(data.group),
title: data?.title && _val(data.title),
description: data?.description && _val(data.description),
group: data?.group && _tval(data.group),
title: data?.title && _tval(data.title),
description: data?.description && _tval(data.description),
args: (data?.args || []).map(x => ({
...x,
label: x?.label && _val(x.label),
label: x?.label && _tval(x.label),
})),
}));

View File

@@ -1,6 +1,6 @@
<script lang="ts" context="module">
import { copyTextToClipboard } from '../utility/clipboard';
import { _t, _val } from '../translations';
import { _t, _tval, DefferedTranslationResult } from '../translations';
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
export const createMatcher =
@@ -76,7 +76,7 @@
}
interface DbObjMenuItem {
label?: string | (() => string);
label?: string | DefferedTranslationResult;
tab?: string;
forceNewTab?: boolean;
initialData?: any;
@@ -719,7 +719,11 @@
const filteredSumenus = coreMenus.map(item => {
if (!item.submenu) {
return { ...item , label: _val(item.label)};
if (!item) return item;
return {...item,
label: _tval(item.label)
};
}
return {
...item,

View File

@@ -1,6 +1,6 @@
<script context="module">
function getCommandTitle(command) {
let res = _val(command.text);
let res = _tval(command.text);
if (command.keyText || command.keyTextFromGroup) {
res += ` (${formatKeyText(command.keyText || command.keyTextFromGroup)})`;
}
@@ -13,7 +13,7 @@
import { formatKeyText } from '../utility/common';
import ToolStripButton from './ToolStripButton.svelte';
import _ from 'lodash';
import { _val } from '../translations';
import { _tval } from '../translations';
export let command;
export let component = ToolStripButton;
@@ -34,6 +34,6 @@
{iconAfter}
{...$$restProps}
>
{(_val(buttonLabel) || _val(cmd?.toolbarName) || _val(cmd?.name))}
{(_tval(buttonLabel) || _tval(cmd?.toolbarName) || _tval(cmd?.name))}
</svelte:component>
{/if}

View File

@@ -24,7 +24,7 @@
import ToolStripCommandButton from './ToolStripCommandButton.svelte';
import ToolStripDropDownButton from './ToolStripDropDownButton.svelte';
import _ from 'lodash';
import { _val } from '../translations';
import { _tval } from '../translations';
export let quickExportHandlerRef = null;
export let command = 'sqlDataGrid.export';
export let label = 'Export';
@@ -40,7 +40,7 @@
{#if hasPermission('dbops/export')}
{#if quickExportHandlerRef}
<ToolStripDropDownButton menu={getExportMenu} label={_val(label)} icon="icon export" />
<ToolStripDropDownButton menu={getExportMenu} label={_tval(label)} icon="icon export" />
{:else}
<ToolStripCommandButton {command} />
{/if}

View File

@@ -81,7 +81,7 @@
import { getLocalStorage } from '../utility/storageCache';
import registerCommand from './registerCommand';
import { formatKeyText, switchCurrentDatabase } from '../utility/common';
import { _val, __t } from '../translations';
import { _tval, __t } from '../translations';
let domInput;
let filter = '';
@@ -114,11 +114,11 @@
($visibleCommandPalette == 'database'
? extractDbItems($databaseInfo, { conid, database }, $connectionList)
: parentCommand
? parentCommand.getSubCommands()
: sortedComands
? parentCommand.getSubCommands()
: sortedComands
).filter(x => !x.isGroupCommand),
{
extract: x => _val(x.text),
extract: x => _tval(x.text),
pre: '<b>',
post: '</b>',
}
@@ -163,10 +163,10 @@
on:clickOutside={() => {
$visibleCommandPalette = null;
}}
data-testid='CommandPalette_main'
data-testid="CommandPalette_main"
>
<div
class="overlay"
<div
class="overlay"
on:click={() => {
$visibleCommandPalette = null;
}}

View File

@@ -27,7 +27,7 @@ registerCommand({
id: 'database.switch',
category: __t('command.database', { defaultMessage: 'Database' }),
name: __t('command.database.changeRecent', { defaultMessage: 'Change to recent' }),
menuName: 'Switch recent database',
menuName: __t('command.database.switchRecent', { defaultMessage: 'Switch recent database' }),
keyText: 'CtrlOrCommand+D',
getSubCommands: () => getRecentDatabases().map(switchDatabaseCommand),
});

View File

@@ -1,7 +1,7 @@
import { commands } from '../stores';
import { invalidateCommandDefinitions } from './invalidateCommands';
import _ from 'lodash';
import { _val } from '../translations';
import { _tval, DefferedTranslationResult, isDefferedTranslationResult } from '../translations';
export interface SubCommand {
text: string;
@@ -10,10 +10,10 @@ export interface SubCommand {
export interface GlobalCommand {
id: string;
category: string | (() => string); // null for group commands
category: string | DefferedTranslationResult; // null for group commands
isGroupCommand?: boolean;
name: string | (() => string);
text?: string | (() => string);
name: string | DefferedTranslationResult;
text?: string | DefferedTranslationResult;
keyText?: string;
keyTextFromGroup?: string; // automatically filled from group
group?: string;
@@ -25,8 +25,8 @@ export interface GlobalCommand {
toolbar?: boolean;
enabled?: boolean;
showDisabled?: boolean;
toolbarName?: string | (() => string);
menuName?: string;
toolbarName?: string | DefferedTranslationResult;
menuName?: string | DefferedTranslationResult;
toolbarOrder?: number;
disableHandleKeyText?: string;
isRelatedToTab?: boolean;
@@ -44,8 +44,10 @@ export default function registerCommand(command: GlobalCommand) {
...x,
[command.id]: {
text:
_.isFunction(command.category) || _.isFunction(command.name)
? () => `${_val(command.category)}: ${_val(command.name)}`
isDefferedTranslationResult(command.category) || isDefferedTranslationResult(command.name)
? {
_transCallback: () => `${_tval(command.category)}: ${_tval(command.name)}`,
}
: `${command.category}: ${command.name}`,
...command,
enabled: !testEnabled,

View File

@@ -192,7 +192,7 @@ registerCommand({
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img shell',
name: __t('command.new.shell', { defaultMessage: 'JavaScript Shell' }),
menuName: 'New JavaScript shell',
menuName: __t('command.new.JSShell', { defaultMessage: 'New JavaScript shell' }),
onClick: () => {
openNewTab({
title: 'Shell #',
@@ -208,7 +208,7 @@ if (isProApp()) {
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img query-design',
name: __t('command.new.queryDesign', { defaultMessage: 'Query design' }),
menuName: 'New query design',
menuName: __t('command.new.newQueryDesign', { defaultMessage: 'New query design' }),
onClick: () => newQueryDesign(),
testEnabled: () =>
getCurrentDatabase() &&
@@ -222,7 +222,7 @@ if (isProApp()) {
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img transform',
name: __t('command.new.modelTransform', { defaultMessage: 'Model transform' }),
menuName: 'New model transform',
menuName: __t('command.new.newModelTransform', { defaultMessage: 'New model transform' }),
onClick: () => {
openNewTab(
{
@@ -266,7 +266,7 @@ if (isProApp()) {
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img perspective',
name: __t('command.new.perspective', { defaultMessage: 'Perspective' }),
menuName: 'New perspective',
menuName: __t('command.new.newPerspective', { defaultMessage: 'New perspective' }),
onClick: () => newPerspective(),
});
}
@@ -277,7 +277,7 @@ if (isProApp()) {
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img app',
name: __t('command.new.application', { defaultMessage: 'Application' }),
menuName: 'New application',
menuName: __t('command.new.newApplication', { defaultMessage: 'New application' }),
onClick: () => {
openNewTab({
title: 'Application #',
@@ -293,7 +293,7 @@ registerCommand({
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img diagram',
name: __t('command.new.diagram', { defaultMessage: 'ER Diagram' }),
menuName: 'New ER diagram',
menuName: __t('command.new.newDiagram', { defaultMessage: 'New ER diagram' }),
testEnabled: () =>
getCurrentDatabase() &&
findEngineDriver(getCurrentDatabase()?.connection, getExtensions())?.databaseEngineTypes?.includes('sql'),
@@ -416,7 +416,7 @@ registerCommand({
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img archive',
name: __t('command.new.jsonl', { defaultMessage: 'JSON Lines' }),
menuName: 'New JSON lines file',
menuName: __t('command.new.newJsonl', { defaultMessage: 'New JSON lines file' }),
onClick: () => {
openNewTab(
{
@@ -436,7 +436,7 @@ registerCommand({
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img sqlite-database',
name: __t('command.new.sqliteDatabase', { defaultMessage: 'SQLite database' }),
menuName: _t('command.new.sqliteDatabase', { defaultMessage: 'New SQLite database' }),
menuName: __t('command.new.sqliteDatabase', { defaultMessage: 'New SQLite database' }),
onClick: () => {
showModal(InputTextModal, {
value: 'newdb',
@@ -456,7 +456,7 @@ registerCommand({
category: __t('command.new', { defaultMessage: 'New' }),
icon: 'img sqlite-database',
name: __t('command.new.duckdbDatabase', { defaultMessage: 'DuckDB database' }),
menuName: _t('command.new.duckdbDatabase', { defaultMessage: 'New DuckDB database' }),
menuName: __t('command.new.duckdbDatabase', { defaultMessage: 'New DuckDB database' }),
onClick: () => {
showModal(InputTextModal, {
value: 'newdb',

View File

@@ -422,7 +422,7 @@
import { openJsonLinesData } from '../utility/openJsonLinesData';
import contextMenuActivator from '../utility/contextMenuActivator';
import InputTextModal from '../modals/InputTextModal.svelte';
import { __t, _t, _val } from '../translations';
import { __t, _t, _tval } from '../translations';
import { isProApp } from '../utility/proTools';
import SaveArchiveModal from '../modals/SaveArchiveModal.svelte';
import hasPermission from '../utility/hasPermission';
@@ -1799,12 +1799,12 @@
text: _t('datagrid.copyAdvanced', { defaultMessage: 'Copy advanced'}),
submenu: [
_.keys(copyRowsFormatDefs).map(format => ({
text: _val(copyRowsFormatDefs[format].label),
text: _tval(copyRowsFormatDefs[format].label),
onClick: () => copyToClipboardCore(format),
})),
{ divider: true },
_.keys(copyRowsFormatDefs).map(format => ({
text: _t('datagrid.setFormat', { defaultMessage: 'Set format: ' }) + (_val(copyRowsFormatDefs[format].name)),
text: _t('datagrid.setFormat', { defaultMessage: 'Set format: ' }) + (_tval(copyRowsFormatDefs[format].name)),
onClick: () => ($copyRowsFormat = format),
})),
@@ -1874,7 +1874,7 @@
return [
menu,
{
text: _val(copyRowsFormatDefs[$copyRowsFormat].label),
text: _tval(copyRowsFormatDefs[$copyRowsFormat].label),
onClick: () => copyToClipboardCore($copyRowsFormat),
keyText: 'CtrlOrCommand+C',
tag: 'copy',

View File

@@ -27,7 +27,7 @@
import { evaluateCondition } from 'dbgate-sqltree';
import { compileCompoudEvalCondition } from 'dbgate-filterparser';
import { chevronExpandIcon } from '../icons/expandIcons';
import { _val } from '../translations';
import { _tval } from '../translations';
export let columns: (TableControlColumn | false)[];
export let rows = null;
@@ -369,7 +369,7 @@
{/if}
{/key}
{:else}
{ _val(row[col.fieldName]) || '' }
{ _tval(row[col.fieldName]) || '' }
{/if}
</td>
{/each}

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { getFormContext } from './FormProviderCore.svelte';
import TextField from './TextField.svelte';
import { _val } from '../translations';
import { _tval } from '../translations';
export let name;
export let defaultValue;
@@ -12,7 +12,7 @@
<TextField
{...$$restProps}
value={$values?.[name] ? _val($values[name]) : defaultValue}
value={$values?.[name] ? _tval($values[name]) : defaultValue}
on:input={e => setFieldValue(name, e.target['value'])}
on:input={e => {
if (saveOnInput) {

View File

@@ -1,7 +1,6 @@
<script lang="ts">
import { commandsCustomized, currentDropDownMenu } from '../stores';
import { prepareMenuItems } from '../utility/contextMenu';
import DropDownMenu from './DropDownMenu.svelte';
export let items;

View File

@@ -4,6 +4,7 @@
import FormSelectField from '../forms/FormSelectField.svelte';
import SelectField from '../forms/SelectField.svelte';
import { lastUsedDefaultActions } from '../stores';
import { _tval } from '../translations';
export let label;
export let objectTypeField;
@@ -18,7 +19,7 @@
defaultValue={defaultDatabaseObjectAppObjectActions[objectTypeField][0]?.defaultActionId}
options={defaultDatabaseObjectAppObjectActions[objectTypeField].map(x => ({
value: x.defaultActionId,
label: x.label,
label: _tval(x.label),
}))}
value={$lastUsedDefaultActions[objectTypeField]}
on:change={e => {

View File

@@ -126,7 +126,7 @@ ORDER BY
<div class="heading">{_t('settings.appearance', { defaultMessage: 'Appearance' })}</div>
<FormCheckboxField
name="app.useNativeMenu"
label={isMac() ? 'Use native window title' : 'Use system native menu'}
label={isMac() ? _t('settings.useNativeWindowTitle', { defaultMessage: 'Use native window title' }) : _t('settings.useSystemNativeMenu', { defaultMessage: 'Use system native menu' })}
on:change={() => {
restartWarning = true;
}}

View File

@@ -1,5 +1,4 @@
<script lang="ts" context="module">
import { _t } from '../translations';
const getCurrentValueMarker: any = {};
@@ -360,7 +359,7 @@
import NewObjectModal from '../modals/NewObjectModal.svelte';
import { isProApp } from '../utility/proTools';
import { openWebLink } from '../utility/simpleTools';
import { __t } from '../translations';
import { __t, _t } from '../translations';
export let multiTabIndex;
export let shownTab;
@@ -437,27 +436,27 @@
return [
tab.tabPreviewMode && {
text: 'Pin tab',
text: _t('tabsPanel.pinTab', { defaultMessage: 'Pin tab' }),
onClick: () => pinTab(tabid),
},
{
text: 'Close',
text: _t('common.close', { defaultMessage: 'Close' }),
onClick: () => closeTab(tabid),
},
{
text: 'Close all',
text: _t('tabsPanel.closeAll', { defaultMessage: 'Close all' }),
onClick: () => closeAll(multiTabIndex),
},
{
text: 'Close others',
text: _t('tabsPanel.closeOthers', { defaultMessage: 'Close others' }),
onClick: () => closeOthersInMultiTab(multiTabIndex)(tabid),
},
{
text: 'Close to the right',
text: _t('tabsPanel.closeToTheRight', { defaultMessage: 'Close to the right' }),
onClick: () => closeRightTabs(multiTabIndex)(tabid),
},
{
text: 'Duplicate',
text: _t('tabsPanel.duplicate', { defaultMessage: 'Duplicate' }),
onClick: () => duplicateTab(tab),
},
tabComponent &&
@@ -466,7 +465,7 @@
tabs[tabComponent].allowAddToFavorites(props) && [
{ divider: true },
{
text: 'Add to favorites',
text: _t('tabsPanel.addToFavorites', { defaultMessage: 'Add to favorites' }),
onClick: () => showModal(FavoriteModal, { savingTab: tab }),
},
],
@@ -476,7 +475,7 @@
tabs[tabComponent].allowSwitchDatabase(props) && [
{ divider: true },
{
text: 'Switch database',
text: _t('tabsPanel.switchDatabase', { defaultMessage: 'Switch database' }),
onClick: () => showModal(SwitchDatabaseModal, { callingTab: tab }),
},
],
@@ -499,11 +498,11 @@
conid &&
database && [
{
text: `Close tabs with DB ${database}`,
text: _t('tabsPanel.closeTabsWithDb', { defaultMessage: 'Close tabs with DB {database}', values: { database } }),
onClick: () => closeWithSameDb(tabid),
},
{
text: `Close tabs with other DB than ${database}`,
text: _t('tabsPanel.closeTabsWithOtherDb', { defaultMessage: `Close tabs with other DB than {database}`, values: { database } }),
onClick: () => closeWithOtherDb(tabid),
},
],

View File

@@ -58,8 +58,13 @@ function getTranslation(key: string, defaultMessage: string, language: string) {
return translation;
}
export function getCurrentTranslations(): Record<string, string> {
const selectedLanguage = getSelectedLanguage();
return translations[selectedLanguage] || {};
}
export function _t(key: string, options: TranslateOptions): string {
const { defaultMessage, values } = options;
const { defaultMessage, values } = options || {};
const selectedLanguage = getSelectedLanguage();
@@ -78,10 +83,32 @@ export function _t(key: string, options: TranslateOptions): string {
return compliledTranslation(values ?? {});
}
export function __t(key: string, options: TranslateOptions): () => string {
return () => _t(key, options);
export type DefferedTranslationResult = {
_transKey?: string;
_transOptions?: TranslateOptions;
_transCallback?: () => string;
};
export function __t(key: string, options: TranslateOptions): DefferedTranslationResult {
return {
_transKey: key,
_transOptions: options,
};
}
export function _val<T>(x: T | (() => T)): T {
return typeof x === 'function' ? (x as () => T)() : x;
export function _tval(x: string | DefferedTranslationResult): string {
if (typeof x === 'string') return x;
if (typeof x?._transKey === 'string') {
return _t(x._transKey, x._transOptions);
}
if (typeof x?._transCallback === 'function') {
return x._transCallback();
}
return '';
}
export function isDefferedTranslationResult(
x: string | DefferedTranslationResult
): x is DefferedTranslationResult {
return typeof x !== 'string' && typeof x?._transKey === 'string';
}

View File

@@ -4,7 +4,7 @@ import invalidateCommands from '../commands/invalidateCommands';
import { runGroupCommand } from '../commands/runCommand';
import { currentDropDownMenu, visibleCommandPalette } from '../stores';
import getAsArray from './getAsArray';
import { _val } from '../translations';
import { _tval } from '../translations';
let isContextMenuSupressed = false;
@@ -115,7 +115,7 @@ function mapItem(item, commands) {
if (command) {
const commandText = item.text || command.menuName || command.toolbarName || command.name;
return {
text: _val(commandText),
text: _tval(commandText),
keyText: command.keyText || command.keyTextFromGroup || command.disableHandleKeyText,
onClick: () => {
if (command.isGroupCommand) {

View File

@@ -23,6 +23,7 @@
import NewObjectModal from '../modals/NewObjectModal.svelte';
import openNewTab from '../utility/openNewTab';
import { useConfig, usePromoWidget } from '../utility/metadataLoaders';
import { _t, getCurrentTranslations } from '../translations';
let domSettings;
let domCloudAccount;
@@ -120,14 +121,14 @@
{ command: 'theme.changeTheme' },
hasPermission('settings/change') && { command: 'settings.commands' },
hasPermission('widgets/plugins') && {
text: 'Manage plugins',
text: _t('widgets.managePlugins', { defaultMessage: 'Manage plugins' }),
onClick: () => {
$selectedWidget = 'plugins';
$visibleWidgetSideBar = true;
},
},
hasPermission('application-log') && {
text: 'View application logs',
text: _t('widgets.viewApplicationLogs', { defaultMessage: 'View application logs' }),
onClick: () => {
openNewTab({
title: 'Application log',
@@ -152,7 +153,7 @@
const rect = domMainMenu.getBoundingClientRect();
const left = rect.right;
const top = rect.top;
const items = mainMenuDefinition({ editMenu: false });
const items = mainMenuDefinition({ editMenu: false }, getCurrentTranslations());
currentDropDownMenu.set({ left, top, items });
}

View File

@@ -102,6 +102,7 @@
"command.database.databaseSearch": "Vyhledávání v databázi",
"command.database.export": "Exportovat databázi",
"command.database.search": "Vyhledat",
"command.database.switchRecent": "Přepnout na nedávnou databázi",
"command.datagrid": "Datová mřížka",
"command.datagrid.addJsonDocument": "Přidat JSON dokument",
"command.datagrid.addNewColumn": "Přidat nový sloupec",
@@ -188,6 +189,7 @@
"command.kill": "Ukončit",
"command.markdown.preview": "Náhled",
"command.new": "Nový",
"command.new.JSShell": "Nový JavaScript shell",
"command.new.application": "Aplikace",
"command.new.archiveFolder": "Složka archivů",
"command.new.collection": "Kolekce",
@@ -202,6 +204,12 @@
"command.new.markdown": "Markdown stránka",
"command.new.modelCompare": "Porovnat DB",
"command.new.modelTransform": "Transformace modelu",
"command.new.newApplication": "Nová aplikace",
"command.new.newDiagram": "Nový ER diagram",
"command.new.newJsonl": "Nový JSON lines soubor",
"command.new.newModelTransform": "Nová transformace modelu",
"command.new.newPerspective": "Nová perspektiva",
"command.new.newQueryDesign": "Nový návrh dotazu",
"command.new.perspective": "Perspektiva",
"command.new.query": "Dotaz",
"command.new.queryDesign": "Design dotazu",
@@ -671,6 +679,11 @@
"indexEditor.filteredIndexCondition": "Podmínka filtrovaného indexu",
"indexEditor.indexName": "Název indexu",
"indexEditor.isUnique": "Je jedinečný index",
"menu.edit": "Upravit",
"menu.file": "Soubor",
"menu.help": "Pomoc",
"menu.tools": "Nástroje",
"menu.view": "Zobrazit",
"newObject.compareDescription": "Porovnat schémata databází",
"newObject.compareDisabled": "Porovnání databází není pro aktuální databázi k dispozici.",
"newObject.connectionLocal": "Připojení k databázi je uloženo lokálně",
@@ -798,6 +811,8 @@
"settings.tabGroup.showServerName": "Zobrazit název serveru vedle názvu databáze v záhlaví skupiny karet",
"settings.theme": "Vzhled",
"settings.title": "Nastavení",
"settings.useNativeWindowTitle": "Použít nativní menu",
"settings.useSystemNativeMenu": "Použít systémové nativní menu",
"sqlObject.collectionName": "Název kolekce",
"sqlObject.columnComment": "Komentář sloupce",
"sqlObject.columnDataType": "Datový typ sloupce",
@@ -872,10 +887,21 @@
"tableEditor.yes": "ANO",
"tableStructure.alter": "Upravit tabulku",
"tableStructure.create": "Vytvořit tabulku",
"tabsPanel.addToFavorites": "Přidat do oblíbených",
"tabsPanel.closeAll": "Zavřít vše",
"tabsPanel.closeOthers": "Zavřít ostatní",
"tabsPanel.closeTabsWithDb": "Zavřít karty s DB {database}",
"tabsPanel.closeTabsWithOtherDb": "Zavřít karty s jinou DB než {database}",
"tabsPanel.closeToTheRight": "Zavřít napravo",
"tabsPanel.duplicate": "Duplikovat",
"tabsPanel.pinTab": "Připnout kartu",
"tabsPanel.switchDatabase": "Přepnout databázi",
"widget.collectionsContainers": "Kolekce/kontejnery",
"widget.databaseContent": "Obsah databáze",
"widget.databases": "Databáze",
"widget.keys": "Klíče",
"widget.pinned": "Připnuté",
"widget.tablesViewsFunctions": "Tabulky, pohledy, funkce"
"widget.tablesViewsFunctions": "Tabulky, pohledy, funkce",
"widgets.managePlugins": "Spravovat pluginy",
"widgets.viewApplicationLogs": "Zobrazit aplikační logy"
}

View File

@@ -102,6 +102,7 @@
"command.database.databaseSearch": "Database search",
"command.database.export": "Export database",
"command.database.search": "Search",
"command.database.switchRecent": "Switch recent database",
"command.datagrid": "Data grid",
"command.datagrid.addJsonDocument": "Add JSON document",
"command.datagrid.addNewColumn": "Add new column",
@@ -188,6 +189,7 @@
"command.kill": "Kill",
"command.markdown.preview": "Preview",
"command.new": "New",
"command.new.JSShell": "New JavaScript shell",
"command.new.application": "Application",
"command.new.archiveFolder": "Archive folder",
"command.new.collection": "Collection",
@@ -202,6 +204,12 @@
"command.new.markdown": "Markdown page",
"command.new.modelCompare": "Compare DB",
"command.new.modelTransform": "Model transform",
"command.new.newApplication": "New application",
"command.new.newDiagram": "New ER diagram",
"command.new.newJsonl": "New JSON lines file",
"command.new.newModelTransform": "New model transform",
"command.new.newPerspective": "New perspective",
"command.new.newQueryDesign": "New query design",
"command.new.perspective": "Perspective",
"command.new.query": "Query",
"command.new.queryDesign": "Query design",
@@ -671,6 +679,11 @@
"indexEditor.filteredIndexCondition": "Filtered index condition",
"indexEditor.indexName": "Index name",
"indexEditor.isUnique": "Is unique index",
"menu.edit": "Edit",
"menu.file": "File",
"menu.help": "Help",
"menu.tools": "Tools",
"menu.view": "View",
"newObject.compareDescription": "Compare database schemas",
"newObject.compareDisabled": "Database comparison is not available for current database",
"newObject.connectionLocal": "Database connection stored locally",
@@ -798,6 +811,8 @@
"settings.tabGroup.showServerName": "Show server name alongside database name in title of the tab group",
"settings.theme": "Themes",
"settings.title": "Settings",
"settings.useNativeWindowTitle": "Use native window title",
"settings.useSystemNativeMenu": "Use system native menu",
"sqlObject.collectionName": "Collection name",
"sqlObject.columnComment": "Column comment",
"sqlObject.columnDataType": "Column data type",
@@ -872,10 +887,21 @@
"tableEditor.yes": "YES",
"tableStructure.alter": "Alter table",
"tableStructure.create": "Create table",
"tabsPanel.addToFavorites": "Add to favorites",
"tabsPanel.closeAll": "Close all",
"tabsPanel.closeOthers": "Close others",
"tabsPanel.closeTabsWithDb": "Close tabs with DB {database}",
"tabsPanel.closeTabsWithOtherDb": "Close tabs with other DB than {database}",
"tabsPanel.closeToTheRight": "Close to the right",
"tabsPanel.duplicate": "Duplicate",
"tabsPanel.pinTab": "Pin tab",
"tabsPanel.switchDatabase": "Switch database",
"widget.collectionsContainers": "Collections/containers",
"widget.databaseContent": "Database content",
"widget.databases": "Databases",
"widget.keys": "Keys",
"widget.pinned": "Pinned",
"widget.tablesViewsFunctions": "Tables, views, functions"
"widget.tablesViewsFunctions": "Tables, views, functions",
"widgets.managePlugins": "Manage plugins",
"widgets.viewApplicationLogs": "View application logs"
}

View File

@@ -102,6 +102,7 @@
"command.database.databaseSearch": "Hľadanie v databáze",
"command.database.export": "Exportovať databázu",
"command.database.search": "Hľadať",
"command.database.switchRecent": "Prepnúť na nedávnu databázu",
"command.datagrid": "Dátová mriežka",
"command.datagrid.addJsonDocument": "Pridať JSON dokument",
"command.datagrid.addNewColumn": "Pridať nový stĺpec",
@@ -188,6 +189,7 @@
"command.kill": "Ukončiť",
"command.markdown.preview": "Náhľad",
"command.new": "Nový",
"command.new.JSShell": "Nový JavaScript shell",
"command.new.application": "Aplikácia",
"command.new.archiveFolder": "Archívny priečinok",
"command.new.collection": "Kolekcia",
@@ -202,6 +204,12 @@
"command.new.markdown": "Markdown stránka",
"command.new.modelCompare": "Porovnať DB",
"command.new.modelTransform": "Transformácia modelu",
"command.new.newApplication": "Nová aplikácia",
"command.new.newDiagram": "Nový ER diagram",
"command.new.newJsonl": "Nový JSON lines súbor",
"command.new.newModelTransform": "Nová transformácia modelu",
"command.new.newPerspective": "Nová perspektíva",
"command.new.newQueryDesign": "Nový návrh dotazu",
"command.new.perspective": "Perspektíva",
"command.new.query": "Dotaz",
"command.new.queryDesign": "Návrh dotazu",
@@ -671,6 +679,11 @@
"indexEditor.filteredIndexCondition": "Podmienka filtrovaného indexu",
"indexEditor.indexName": "Názov indexu",
"indexEditor.isUnique": "Je jedinečný index",
"menu.edit": "Upraviť",
"menu.file": "Súbor",
"menu.help": "Pomoc",
"menu.tools": "Nástroje",
"menu.view": "Zobraziť",
"newObject.compareDescription": "Porovnať schémy databáz",
"newObject.compareDisabled": "Porovnávanie databáz nie je k dispozícii pre aktuálnu databázu",
"newObject.connectionLocal": "Pripojenie databázy uložené lokálne",
@@ -798,6 +811,8 @@
"settings.tabGroup.showServerName": "Zobraziť názov servera vedľa názvu databázy v názve skupiny kariet",
"settings.theme": "Vzhľad",
"settings.title": "Nastavenia",
"settings.useNativeWindowTitle": "Použiť natívne menu",
"settings.useSystemNativeMenu": "Použiť natívne systémové menu",
"sqlObject.collectionName": "Názov kolekcie",
"sqlObject.columnComment": "Komentár stĺpca",
"sqlObject.columnDataType": "Dátový typ stĺpca",
@@ -872,10 +887,21 @@
"tableEditor.yes": "ÁNO",
"tableStructure.alter": "Úprava tabuľky",
"tableStructure.create": "Vytvoriť tabuľku",
"tabsPanel.addToFavorites": "Pridať do obľúbených",
"tabsPanel.closeAll": "Zavrieť všetko",
"tabsPanel.closeOthers": "Zavrieť ostatné",
"tabsPanel.closeTabsWithDb": "Zavrieť karty s DB {database}",
"tabsPanel.closeTabsWithOtherDb": "Zavrieť karty s inou DB než {database}",
"tabsPanel.closeToTheRight": "Zavrieť napravo",
"tabsPanel.duplicate": "Duplikovať",
"tabsPanel.pinTab": "Pripnúť kartu",
"tabsPanel.switchDatabase": "Prepnúť databázu",
"widget.collectionsContainers": "Kolekcie/kontajnery",
"widget.databaseContent": "Obsah databázy",
"widget.databases": "Databázy",
"widget.keys": "Kľúče",
"widget.pinned": "Pripnuté",
"widget.tablesViewsFunctions": "Tabuľky, pohľady, funkcie"
"widget.tablesViewsFunctions": "Tabuľky, pohľady, funkcie",
"widgets.managePlugins": "Spravovať pluginy",
"widgets.viewApplicationLogs": "Zobraziť aplikačné logy"
}