translation - settings, menu

This commit is contained in:
Stela Augustinova
2025-11-14 17:03:54 +01:00
committed by SPRINX0\prochazka
parent 7bb9414be8
commit edf9f3a2be
11 changed files with 77 additions and 23 deletions

View File

@@ -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 },

View File

@@ -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,

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

@@ -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;

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

@@ -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)}
</div>
{/each}
</div>

View File

@@ -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 => {

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

@@ -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",

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",
@@ -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",

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",
@@ -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",