From edf9f3a2be8f5d50f516d85c2c1cb89323b6ca94 Mon Sep 17 00:00:00 2001 From: Stela Augustinova Date: Fri, 14 Nov 2025 17:03:54 +0100 Subject: [PATCH] translation - settings, menu --- app/src/mainMenuDefinition.js | 16 ++++++++-------- .../src/appobj/DatabaseObjectAppObject.svelte | 6 +++++- .../web/src/commands/recentDatabaseSwitch.ts | 2 +- packages/web/src/commands/registerCommand.ts | 2 +- packages/web/src/commands/stdCommands.ts | 18 +++++++++--------- packages/web/src/modals/HorizontalMenu.svelte | 3 ++- .../src/settings/FormDefaultActionField.svelte | 3 ++- packages/web/src/settings/SettingsModal.svelte | 2 +- translations/cs.json | 16 ++++++++++++++++ translations/en.json | 16 ++++++++++++++++ translations/sk.json | 16 ++++++++++++++++ 11 files changed, 77 insertions(+), 23 deletions(-) diff --git a/app/src/mainMenuDefinition.js b/app/src/mainMenuDefinition.js index cdafb65c7..0c3585f2e 100644 --- a/app/src/mainMenuDefinition.js +++ b/app/src/mainMenuDefinition.js @@ -1,10 +1,10 @@ -function _t(key, { defaultMessage }) { - return global.TRANSLATION_DATA?.[key] || defaultMessage; -} +function _t(id, defaultMessage) { + return {id, defaultMessage}; +}; module.exports = ({ editMenu, isMac }) => [ { - label: _t('app.databaseName', { defaultMessage: 'DB NAME' }), + label: _t('menu.file', { defaultMessage: 'File' }), submenu: [ { command: 'new.connection', hideDisabled: true }, { command: 'new.sqliteDatabase', hideDisabled: true }, @@ -32,7 +32,7 @@ module.exports = ({ editMenu, isMac }) => [ }, editMenu ? { - label: 'Edit', + label: _t('menu.edit', { defaultMessage: 'Edit' }), submenu: [ { command: 'edit.undo' }, { command: 'edit.redo' }, @@ -57,7 +57,7 @@ module.exports = ({ editMenu, isMac }) => [ // ], // }, { - label: 'View', + label: _t('menu.view', { defaultMessage: 'View' }), submenu: [ { command: 'app.reload', hideDisabled: true }, { command: 'app.toggleDevTools', hideDisabled: true }, @@ -79,7 +79,7 @@ module.exports = ({ editMenu, isMac }) => [ ], }, { - label: 'Tools', + label: _t('menu.tools', { defaultMessage: 'Tools' }), submenu: [ { command: 'database.search', hideDisabled: true }, { command: 'commandPalette.show', hideDisabled: true }, @@ -106,7 +106,7 @@ module.exports = ({ editMenu, isMac }) => [ ] : []), { - label: 'Help', + label: _t('menu.help', { defaultMessage: 'Help' }), submenu: [ { command: 'app.openDocs', hideDisabled: true }, { command: 'app.openWeb', hideDisabled: true }, diff --git a/packages/web/src/appobj/DatabaseObjectAppObject.svelte b/packages/web/src/appobj/DatabaseObjectAppObject.svelte index d46294c5d..c7ea24918 100644 --- a/packages/web/src/appobj/DatabaseObjectAppObject.svelte +++ b/packages/web/src/appobj/DatabaseObjectAppObject.svelte @@ -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: _val(item.label) + }; } return { ...item, diff --git a/packages/web/src/commands/recentDatabaseSwitch.ts b/packages/web/src/commands/recentDatabaseSwitch.ts index 36dbb0c0f..a9fd3af2f 100644 --- a/packages/web/src/commands/recentDatabaseSwitch.ts +++ b/packages/web/src/commands/recentDatabaseSwitch.ts @@ -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), }); diff --git a/packages/web/src/commands/registerCommand.ts b/packages/web/src/commands/registerCommand.ts index 0c5d44108..0d4d0c649 100644 --- a/packages/web/src/commands/registerCommand.ts +++ b/packages/web/src/commands/registerCommand.ts @@ -26,7 +26,7 @@ export interface GlobalCommand { enabled?: boolean; showDisabled?: boolean; toolbarName?: string | (() => string); - menuName?: string; + menuName?: string | (() => string); toolbarOrder?: number; disableHandleKeyText?: string; isRelatedToTab?: boolean; diff --git a/packages/web/src/commands/stdCommands.ts b/packages/web/src/commands/stdCommands.ts index 54f0f3854..073fa7683 100644 --- a/packages/web/src/commands/stdCommands.ts +++ b/packages/web/src/commands/stdCommands.ts @@ -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', diff --git a/packages/web/src/modals/HorizontalMenu.svelte b/packages/web/src/modals/HorizontalMenu.svelte index b85c986ed..8dcbca5da 100644 --- a/packages/web/src/modals/HorizontalMenu.svelte +++ b/packages/web/src/modals/HorizontalMenu.svelte @@ -2,6 +2,7 @@ import { commandsCustomized, currentDropDownMenu } from '../stores'; import { prepareMenuItems } from '../utility/contextMenu'; import DropDownMenu from './DropDownMenu.svelte'; + import { _t } from '../translations'; export let items; @@ -37,7 +38,7 @@ } }} > - {item.text || item.label} + {item.text || _t(item.label.id, item.label.defaultMessage)} {/each} diff --git a/packages/web/src/settings/FormDefaultActionField.svelte b/packages/web/src/settings/FormDefaultActionField.svelte index f0cdeb3bc..a9c77fc24 100644 --- a/packages/web/src/settings/FormDefaultActionField.svelte +++ b/packages/web/src/settings/FormDefaultActionField.svelte @@ -4,6 +4,7 @@ import FormSelectField from '../forms/FormSelectField.svelte'; import SelectField from '../forms/SelectField.svelte'; import { lastUsedDefaultActions } from '../stores'; + import { _val } 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: _val(x.label), }))} value={$lastUsedDefaultActions[objectTypeField]} on:change={e => { diff --git a/packages/web/src/settings/SettingsModal.svelte b/packages/web/src/settings/SettingsModal.svelte index ba062e1ed..e1bbaea9f 100644 --- a/packages/web/src/settings/SettingsModal.svelte +++ b/packages/web/src/settings/SettingsModal.svelte @@ -126,7 +126,7 @@ ORDER BY
{_t('settings.appearance', { defaultMessage: 'Appearance' })}
{ restartWarning = true; }} diff --git a/translations/cs.json b/translations/cs.json index 622a24995..ea9b962ac 100644 --- a/translations/cs.json +++ b/translations/cs.json @@ -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ě", @@ -714,6 +727,7 @@ "settings.appearance.editorTheme.default": "(použít výchozí téma)", "settings.appearance.fontFamily": "Písmo editoru", "settings.appearance.fontSize": "Velikost fontu", + "settings.appearance.fontSize.custom": "vlastní", "settings.appearance.moreThemes": "Více témat je k dispozici jako", "settings.appearance.useSystemTheme": "Použít systémové téma", "settings.behaviour": "Chování", @@ -798,6 +812,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", diff --git a/translations/en.json b/translations/en.json index 164dd9cb8..79e3a6956 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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", @@ -714,6 +727,7 @@ "settings.appearance.editorTheme.default": "(use theme default)", "settings.appearance.fontFamily": "Editor font family", "settings.appearance.fontSize": "Font size", + "settings.appearance.fontSize.custom": "custom", "settings.appearance.moreThemes": "More themes are available as", "settings.appearance.useSystemTheme": "Use system theme", "settings.behaviour": "Behaviour", @@ -798,6 +812,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", diff --git a/translations/sk.json b/translations/sk.json index eed7194c6..8aa9ea35b 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -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", @@ -714,6 +727,7 @@ "settings.appearance.editorTheme.default": "(použiť predvolenú tému)", "settings.appearance.fontFamily": "Písmo editora", "settings.appearance.fontSize": "Veľkosť písma", + "settings.appearance.fontSize.custom": "vlastné", "settings.appearance.moreThemes": "Viac tém je k dispozícii ako", "settings.appearance.useSystemTheme": "Použiť systémovú tému", "settings.behaviour": "Správanie", @@ -798,6 +812,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",