From d2c471306c6b818e8a0b9d9f222640bf41812d3f Mon Sep 17 00:00:00 2001 From: Jinpy Date: Mon, 28 Sep 2026 00:37:36 +0800 Subject: [PATCH] feat(plugins): localize options_action and rework dock plus picker --- .../plugins/PluginBottomDock.spec.ts | 103 ++++++++++++- .../components/plugins/PluginBottomDock.vue | 137 ++++++++++++++---- .../plugins/PluginConnectionFields.spec.ts | 2 +- .../plugins/PluginConnectionFields.vue | 6 +- apps/desktop/src/i18n/locales/en.ts | 1 - apps/desktop/src/i18n/locales/es.ts | 1 - apps/desktop/src/i18n/locales/it.ts | 1 - apps/desktop/src/i18n/locales/ja.ts | 1 - apps/desktop/src/i18n/locales/ko.ts | 1 - apps/desktop/src/i18n/locales/pt-BR.ts | 1 - apps/desktop/src/i18n/locales/ru.ts | 1 - apps/desktop/src/i18n/locales/zh-CN.ts | 1 - apps/desktop/src/i18n/locales/zh-TW.ts | 1 - apps/desktop/src/types/database.ts | 10 +- 14 files changed, 220 insertions(+), 47 deletions(-) diff --git a/apps/desktop/src/components/plugins/PluginBottomDock.spec.ts b/apps/desktop/src/components/plugins/PluginBottomDock.spec.ts index ee4a830b1a..b54f2b61c3 100644 --- a/apps/desktop/src/components/plugins/PluginBottomDock.spec.ts +++ b/apps/desktop/src/components/plugins/PluginBottomDock.spec.ts @@ -1,14 +1,14 @@ // @vitest-environment happy-dom -import { createApp, defineComponent, h, ref, type App } from "vue"; +import { createApp, defineComponent, h, inject, provide, ref, type App } from "vue"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { InstalledPlugin } from "@/types/database"; -const mocks = vi.hoisted(() => ({ listPlugins: vi.fn(), invokePlugin: vi.fn() })); +const mocks = vi.hoisted(() => ({ listPlugins: vi.fn(), invokePlugin: vi.fn(), useConnectionStore: vi.fn() })); vi.mock("@/lib/backend/api", () => ({ listPlugins: mocks.listPlugins, invokePlugin: mocks.invokePlugin })); vi.mock("vue-i18n", () => ({ useI18n: () => ({ locale: ref("en"), t: (key: string) => key }) })); -vi.mock("@/stores/connectionStore", () => ({ useConnectionStore: () => ({ connections: [] }) })); +vi.mock("@/stores/connectionStore", () => ({ useConnectionStore: mocks.useConnectionStore })); vi.mock("@/stores/queryStore", () => ({ useQueryStore: () => ({}) })); vi.mock("@/components/ui/button", () => ({ Button: defineComponent( @@ -35,6 +35,37 @@ vi.mock("@/components/ui/tooltip", () => ({ ), })); vi.mock("./PluginIcon.vue", () => ({ default: defineComponent(() => () => h("span")) })); +vi.mock("@/components/icons/ConnectionIcon.vue", () => ({ default: defineComponent(() => () => h("span", { "data-connection-icon-stub": "" })) })); +// DropdownMenu harness: content renders unconditionally and the trigger's +// click forwards `update:open`, so picker tests assert menu content and item +// selection without depending on reka-ui's floating/portal behavior. +vi.mock("@/components/ui/dropdown-menu", () => ({ + DropdownMenu: defineComponent({ + props: { open: { type: Boolean, default: false } }, + emits: ["update:open"], + setup(_, { slots, emit }) { + provide("dbxDropdownTestSetOpen", (value: boolean) => emit("update:open", value)); + return () => h("div", { "data-dropdown-menu-stub": "" }, slots.default?.()); + }, + }), + DropdownMenuTrigger: defineComponent({ + setup(_, { slots }) { + const setOpen = inject<(value: boolean) => void>("dbxDropdownTestSetOpen")!; + return () => h("div", { onClick: () => setOpen(true) }, slots.default?.()); + }, + }), + DropdownMenuContent: defineComponent( + (_, { slots }) => + () => + h("div", { "data-plugin-dock-plus-menu": "" }, slots.default?.()), + ), + DropdownMenuItem: defineComponent({ + emits: ["select"], + setup(_, { slots, emit }) { + return () => h("div", { "data-dropdown-item-stub": "", onClick: () => emit("select", {}) }, slots.default?.()); + }, + }), +})); // Mirrors the real PluginWorkbenchHost, whose title computed dereferences // props.contribution.label unconditionally — an undefined contribution must // never reach it, otherwise the whole dock subtree crashes during render. @@ -70,6 +101,7 @@ describe("PluginBottomDock workbench contribution guard", () => { beforeEach(() => { vi.clearAllMocks(); + mocks.useConnectionStore.mockReturnValue({ connections: [], sidebarLayout: { groups: [], order: [] }, ensureConnected: vi.fn(() => Promise.resolve()) }); root = document.createElement("div"); document.body.appendChild(root); }); @@ -137,11 +169,76 @@ describe("PluginBottomDock workbench contribution guard", () => { expect(renderError).toBeUndefined(); expect(mocks.invokePlugin).not.toHaveBeenCalled(); expect(warnSpy.mock.calls.filter((call) => String(call[0]).includes("[DBX][plugin:dock]"))).toEqual([]); + // Without options_action the command doesn't own the picker, so the + // generic replay item stays visible. + expect(root.querySelector("[data-plugin-dock-plus-menu]")?.textContent).toContain("pluginDock.newTerminal"); } finally { warnSpy.mockRestore(); } }); + it("passes the current UI locale to the options_action fetch", async () => { + // Sidecars need the UI language to localize launch-option labels; the host + // used to call options_action with an empty payload. + const plugin = installedPlugin("sample.panel"); + plugin.manifest.contributions!.push({ + type: "command", + id: "sample.open", + label: "Open sample", + action: { type: "open-workbench", workbench: "sample.panel", presentation: "panel", options_action: "local/terminal/launch-options" }, + }); + mocks.listPlugins.mockResolvedValue([plugin]); + mocks.invokePlugin.mockResolvedValue({ entries: [{ label: "Local terminal (auto-detect)", description: "Default shell: /bin/zsh", context: {} }] }); + entryIds.push(dock.addPluginDockEntry({ pluginId: "io.dbx.sample", workbenchContributionId: "sample.panel", kind: "command", commandId: "sample.open", title: "Sample terminal" })); + await mountDock(); + await new Promise((resolve) => setTimeout(resolve, 0)); + + expect(mocks.invokePlugin).toHaveBeenCalledWith("io.dbx.sample", "local/terminal/launch-options", { locale: "en" }); + const menu = root.querySelector("[data-plugin-dock-plus-menu]"); + expect(menu?.textContent).toContain("Local terminal (auto-detect)"); + expect(menu?.textContent).toContain("Default shell: /bin/zsh"); + // The plugin owns the picker now: the generic replay item hides. + expect(menu?.textContent).not.toContain("pluginDock.newTerminal"); + }); + + it("renders the + picker connection targets as sidebar-grouped rows and opens them on pick", async () => { + const plugin = installedPlugin("sample.panel"); + plugin.manifest.contributions!.push( + { type: "connection-provider", id: "ssh", label: "SSH", database_type: "plugin", fields: [] }, + { + type: "command", + id: "sample.open", + label: "Open sample", + action: { type: "open-workbench", workbench: "sample.panel", presentation: "panel", connection_targets: true }, + }, + ); + mocks.listPlugins.mockResolvedValue([plugin]); + mocks.useConnectionStore.mockReturnValue({ + connections: [{ id: "conn-1", name: "my-server", plugin_connection_provider: "ssh" }], + sidebarLayout: { + groups: [{ id: "g1", name: "Prod", collapsed: false }], + order: [{ type: "group", id: "g1", children: [{ type: "connection", id: "conn-1" }] }], + }, + ensureConnected: vi.fn(() => Promise.resolve()), + }); + entryIds.push(dock.addPluginDockEntry({ pluginId: "io.dbx.sample", workbenchContributionId: "sample.panel", kind: "command", commandId: "sample.open", title: "Sample terminal" })); + await mountDock(); + await new Promise((resolve) => setTimeout(resolve, 0)); + + const menu = root.querySelector("[data-plugin-dock-plus-menu]")!; + expect(menu.textContent).toContain("Prod"); + expect(menu.textContent).toContain("my-server"); + // The flat "connection · name" prefix is gone; rows carry icons instead. + expect(menu.textContent).not.toContain("pluginDock.connectionTerminal"); + + const row = [...menu.querySelectorAll("[data-dropdown-item-stub]")].find((element) => element.textContent?.includes("my-server")) as HTMLElement; + row.click(); + const state = dock.usePluginBottomDock(); + const picked = state.entries.value[state.entries.value.length - 1]!; + entryIds.push(picked.id); + expect(picked).toMatchObject({ kind: "connection", context: { connectionId: "conn-1" } }); + }); + it("degrades to an empty frame instead of crashing when the plugin no longer declares the entry's workbench contribution", async () => { // Plugin upgrade/downgrade replaced the workbench id the entry was opened with. mocks.listPlugins.mockResolvedValue([installedPlugin("sample.renamed")]); diff --git a/apps/desktop/src/components/plugins/PluginBottomDock.vue b/apps/desktop/src/components/plugins/PluginBottomDock.vue index 3d6145630c..476497dd2b 100644 --- a/apps/desktop/src/components/plugins/PluginBottomDock.vue +++ b/apps/desktop/src/components/plugins/PluginBottomDock.vue @@ -6,10 +6,11 @@ // Each entry owns a host-stable workbenchId; v-show keeps sessions alive while switching tabs. import { computed, nextTick, onScopeDispose, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; -import { ChevronDown, ChevronUp, Maximize2, Minimize2, Plus, X } from "@lucide/vue"; +import { ChevronDown, ChevronRight, ChevronUp, Folder, Maximize2, Minimize2, Plus, X } from "@lucide/vue"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; -import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import ConnectionIcon from "@/components/icons/ConnectionIcon.vue"; import PluginIcon from "@/components/plugins/PluginIcon.vue"; import PluginWorkbenchHost from "@/components/plugins/PluginWorkbenchHost.vue"; import { useConnectionStore } from "@/stores/connectionStore"; @@ -28,6 +29,7 @@ import { usePluginBottomDock, type PluginDockEntry, } from "@/lib/plugins/pluginBottomDock"; +import { buildConnectionPickerRows } from "@/lib/connection/connectionPickerTree"; import { useDockResize } from "@/composables/useDockResize"; import { executePluginCommand } from "@/lib/plugins/pluginCommandRegistry"; import { createFrontendPluginRegistry } from "@/lib/plugins/frontendPlugin"; @@ -36,7 +38,7 @@ import { useQueryStore } from "@/stores/queryStore"; import * as api from "@/lib/backend/api"; import type { InstalledPlugin, PluginWorkbenchContribution } from "@/types/database"; -const { t } = useI18n(); +const { t, locale } = useI18n(); // Tab strip interactions (drag reorder + double-click rename). const dragEntryId = ref(null); const renamingEntryId = ref(null); @@ -179,7 +181,9 @@ async function loadLaunchOptions() { // options_action is OPTIONAL on open-workbench commands: without it there is // nothing to fetch — proceeding fired a doomed invokePlugin(undefined) IPC // round trip and a console.warn on every picker open / entry switch. - const cacheKey = action?.options_action && pluginId && commandId ? `${pluginId}:${commandId}` : ""; + // The locale is part of the cache key: a UI language switch must refetch + // instead of repainting labels cached under the previous language. + const cacheKey = action?.options_action && pluginId && commandId ? `${pluginId}:${commandId}:${locale.value}` : ""; if (!cacheKey) { launchOptionEntries.value = []; return; @@ -191,7 +195,10 @@ async function loadLaunchOptions() { launchOptionEntries.value = cached ?? []; launchOptionsLoading.value = !cached; try { - const result = await api.invokePlugin<{ entries?: Array<{ label: string; description?: string; context?: Record }> }>(pluginId!, action!.options_action!, {}); + // locale tells the sidecar which UI language to label the entries in — + // the same field the plugin UI webview receives at init. Sidecars that + // don't read it are unaffected (they ignore the extra param). + const result = await api.invokePlugin<{ entries?: Array<{ label: string; description?: string; context?: Record }> }>(pluginId!, action!.options_action!, { locale: locale.value }); const next = (result?.entries ?? []).map((entry, index) => ({ key: `opt:${index}`, label: entry.label, description: entry.description, context: entry.context })); launchOptionsCache.set(cacheKey, next); // A stale response (entry switched while fetching) must not overwrite the @@ -385,28 +392,76 @@ const plusOpen = ref(false); // what the entries mean. const plusFilter = ref(""); const PLUS_FILTER_THRESHOLD = 8; -const plusItemCount = computed(() => 1 + launchOptionEntries.value.length + connectionTargets.value.length); +// A command declaring options_action owns this picker: the generic replay +// item hides (replaying a singleton command would only refocus the live +// panel — multi-open is exactly what the plugin's own options exist for). +const showReplayItem = computed(() => !activeAction.value?.options_action); +const plusItemCount = computed(() => (showReplayItem.value ? 1 : 0) + launchOptionEntries.value.length + connectionTargets.value.length); const plusQuery = computed(() => plusFilter.value.trim().toLowerCase()); function plusMatches(label: string): boolean { return !plusQuery.value || label.toLowerCase().includes(plusQuery.value); } const visibleLaunchOptions = computed(() => launchOptionEntries.value.filter((option) => plusMatches(option.label))); -const visibleConnectionTargets = computed(() => connectionTargets.value.filter((target) => plusMatches(optionLabel(target)))); -function optionLabel(target: { label: string }): string { - return target.label; +// Connection rows reuse the AI assistant's connection tree select logic +// (buildConnectionPickerRows): sidebar groups, per-connection icons, and a +// search that also matches group paths and force-expands its matches — the +// flat label filter below stays for the replay/launch-option items only. +// Collapsed groups are dock-local view state. +const collapsedPickerGroups = ref(new Set()); +const connectionById = computed(() => new Map(connectionTargets.value.map((target) => [target.connection.id, target.connection]))); +const connectionPickerRows = computed(() => + buildConnectionPickerRows( + connectionStore.sidebarLayout, + connectionTargets.value.map((target) => target.connection), + collapsedPickerGroups.value, + plusQuery.value, + ), +); +function togglePickerGroup(groupId: string) { + if (plusQuery.value) return; + const next = new Set(collapsedPickerGroups.value); + if (!next.delete(groupId)) next.add(groupId); + collapsedPickerGroups.value = next; } -function setPlusOpen(open: boolean) { - plusOpen.value = open; +const plusHasMatches = computed(() => (showReplayItem.value && plusMatches(t("pluginDock.newTerminal"))) || visibleLaunchOptions.value.length > 0 || connectionPickerRows.value.length > 0); +async function setPlusOpen(open: boolean) { plusFilter.value = ""; - if (open) { - void loadLaunchOptions(); - warmActivePluginPanelHtml(); + if (!open) { + plusOpen.value = false; + return; } + // Collapsed dock: the strip hugs the window bottom edge, leaving no room + // below the "+" for a downward picker. Restore the panel body first — the + // picker is about to add a panel entry, which a collapsed frame would hide. + if (collapsed.value) collapsed.value = false; + await nextTick(); + measurePlusMenuHeight(); + plusOpen.value = true; + void loadLaunchOptions(); + warmActivePluginPanelHtml(); } function closePlusMenu() { plusOpen.value = false; } +// Keep the "+" picker opening strictly downward. reka's menu chain silently +// drops the `side-flip` prop (MenuContentImpl forwards side/align/sticky/... to +// PopperContent but not sideFlip), so the flip middleware is always live: any +// bottom overflow makes the menu jump above the trigger. Instead of fighting +// the middleware, cap the menu height to the space remaining under the trigger +// — floating-ui then never sees a bottom overflow, so the menu can only open +// downward, while cross-axis shift keeps it inside the window near the edges. +// Must run before `plusOpen` flips true: the inline cap has to be bound when +// the content mounts, or the first uncapped measurement would still flip it. +const PLUS_MENU_MIN_HEIGHT_PX = 80; +const plusMenuMaxHeight = ref(); +function measurePlusMenuHeight() { + const trigger = dockRoot.value?.querySelector("[data-plugin-dock-plus-trigger]"); + if (!trigger) return; + const below = window.innerHeight - trigger.getBoundingClientRect().bottom - 8; + plusMenuMaxHeight.value = `${Math.max(PLUS_MENU_MIN_HEIGHT_PX, below)}px`; +} + // Hide the first-open html pipeline under the time the user spends reading the // "+" picker: the read/decode/inline of a multi-megabyte ui build runs while // the menu is open, so whichever panel the user picks mounts on a warm cache @@ -489,31 +544,55 @@ onScopeDispose(() => window.removeEventListener("blur", onPlusMenuWindowBlur)); viewport edge instead of running off-screen. --> - - - + + - + - {{ t("pluginDock.newTerminal") }} + {{ t("pluginDock.newTerminal") }} - {{ option.label }} + + + {{ option.label }} + {{ option.description }} + - - {{ t("pluginDock.connectionTerminal") }} · {{ target.label }} - -
+ + +
{{ t("pluginDock.noMatch") }}
diff --git a/apps/desktop/src/components/plugins/PluginConnectionFields.spec.ts b/apps/desktop/src/components/plugins/PluginConnectionFields.spec.ts index ef243dda82..f772fc8a63 100644 --- a/apps/desktop/src/components/plugins/PluginConnectionFields.spec.ts +++ b/apps/desktop/src/components/plugins/PluginConnectionFields.spec.ts @@ -438,7 +438,7 @@ describe("PluginConnectionFields", () => { await mountContribution(dynamic, { sudo_profile: "ghost" }, "io.dbx.ssh"); await flushAsync(); - expect(invokePluginMock).toHaveBeenCalledWith("io.dbx.ssh", "sudo/profiles/options"); + expect(invokePluginMock).toHaveBeenCalledWith("io.dbx.ssh", "sudo/profiles/options", { locale: "en" }); expect(document.querySelector("input#dyn-connection-sudo_profile")).toBeNull(); const trigger = document.querySelector('#dyn-connection-sudo_profile, button[role="combobox"]'); expect(trigger).not.toBeNull(); diff --git a/apps/desktop/src/components/plugins/PluginConnectionFields.vue b/apps/desktop/src/components/plugins/PluginConnectionFields.vue index b7d22d3a55..a75e684f26 100644 --- a/apps/desktop/src/components/plugins/PluginConnectionFields.vue +++ b/apps/desktop/src/components/plugins/PluginConnectionFields.vue @@ -28,7 +28,7 @@ const emit = defineEmits<{ "update:modelValue": [value: Record]; }>(); -const { t } = useI18n(); +const { t, locale } = useI18n(); const { toast } = useToast(); const formValues = computed(() => props.modelValue); @@ -118,7 +118,9 @@ watch( const action = field.options_action; if (!action || !props.pluginId || dynamicOptionsRequested.value.has(field.key)) continue; dynamicOptionsRequested.value.add(field.key); - invokePlugin<{ options?: PluginFormFieldOption[] }>(props.pluginId, action) + // locale lets the sidecar localize the returned option labels (same + // field the plugin UI webview receives at init); older sidecars ignore it. + invokePlugin<{ options?: PluginFormFieldOption[] }>(props.pluginId, action, { locale: locale.value }) .then((result) => { const options = Array.isArray(result?.options) ? result.options.filter((option) => option && option.value !== undefined) : []; dynamicOptions.value = { ...dynamicOptions.value, [field.key]: options }; diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts index 9b6351849c..93c2c82e91 100644 --- a/apps/desktop/src/i18n/locales/en.ts +++ b/apps/desktop/src/i18n/locales/en.ts @@ -685,7 +685,6 @@ export default { restore: "Restore panel", newTerminal: "New terminal", newLocalTerminal: "Local terminal", - connectionTerminal: "Connection", filter: "Filter…", noMatch: "No matches", }, diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts index 3fbb254331..4aa9fe1ea2 100644 --- a/apps/desktop/src/i18n/locales/es.ts +++ b/apps/desktop/src/i18n/locales/es.ts @@ -676,7 +676,6 @@ export default withEnglishFallback({ restore: "Restaurar panel", newTerminal: "Nuevo terminal", newLocalTerminal: "Terminal local", - connectionTerminal: "Conexión", filter: "Filtrar…", noMatch: "Sin coincidencias", }, diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts index 9c402ff61c..5239b4025d 100644 --- a/apps/desktop/src/i18n/locales/it.ts +++ b/apps/desktop/src/i18n/locales/it.ts @@ -671,7 +671,6 @@ export default withEnglishFallback({ restore: "Ripristina pannello", newTerminal: "Nuovo terminale", newLocalTerminal: "Terminale locale", - connectionTerminal: "Connessione", filter: "Filtra…", noMatch: "Nessuna corrispondenza", }, diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts index 1ec1609e29..59aabb2832 100644 --- a/apps/desktop/src/i18n/locales/ja.ts +++ b/apps/desktop/src/i18n/locales/ja.ts @@ -671,7 +671,6 @@ export default withEnglishFallback({ restore: "パネルを元に戻す", newTerminal: "新規ターミナル", newLocalTerminal: "ローカルターミナル", - connectionTerminal: "接続", filter: "フィルタ…", noMatch: "一致する項目がありません", }, diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts index 40e697da25..d5aa47fb38 100644 --- a/apps/desktop/src/i18n/locales/ko.ts +++ b/apps/desktop/src/i18n/locales/ko.ts @@ -678,7 +678,6 @@ export default withEnglishFallback({ restore: "패널 복원", newTerminal: "새 터미널", newLocalTerminal: "로컬 터미널", - connectionTerminal: "연결", filter: "필터…", noMatch: "일치 항목이 없습니다", }, diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts index ce5bc83832..8bba03aa0c 100644 --- a/apps/desktop/src/i18n/locales/pt-BR.ts +++ b/apps/desktop/src/i18n/locales/pt-BR.ts @@ -671,7 +671,6 @@ export default withEnglishFallback({ restore: "Restaurar painel", newTerminal: "Novo terminal", newLocalTerminal: "Terminal local", - connectionTerminal: "Conexão", filter: "Filtrar…", noMatch: "Nenhuma correspondência", }, diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts index 6792bf9dc4..25aa034df4 100644 --- a/apps/desktop/src/i18n/locales/ru.ts +++ b/apps/desktop/src/i18n/locales/ru.ts @@ -630,7 +630,6 @@ export default withEnglishFallback({ restore: "Восстановить панель", newTerminal: "Новый терминал", newLocalTerminal: "Локальный терминал", - connectionTerminal: "Подключение", filter: "Фильтр…", noMatch: "Совпадений нет", }, diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts index c8ad0d465c..fdbcd23e45 100644 --- a/apps/desktop/src/i18n/locales/zh-CN.ts +++ b/apps/desktop/src/i18n/locales/zh-CN.ts @@ -601,7 +601,6 @@ export default withEnglishFallback({ restore: "还原面板", newTerminal: "新建终端", newLocalTerminal: "本地终端", - connectionTerminal: "连接", filter: "筛选…", noMatch: "没有匹配项", }, diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts index 6aa40920e5..a42142611c 100644 --- a/apps/desktop/src/i18n/locales/zh-TW.ts +++ b/apps/desktop/src/i18n/locales/zh-TW.ts @@ -674,7 +674,6 @@ export default withEnglishFallback({ restore: "還原面板", newTerminal: "新增終端", newLocalTerminal: "本機終端", - connectionTerminal: "連線", filter: "篩選…", noMatch: "沒有符合項目", }, diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts index 6696d11d42..8feac2204c 100644 --- a/apps/desktop/src/types/database.ts +++ b/apps/desktop/src/types/database.ts @@ -362,7 +362,9 @@ export interface PluginFormField { default?: PluginFormFieldValue | null; options?: PluginFormFieldOption[]; /** Plugin method returning `{ options: [{ value, label }] }` for dynamic - * select rendering; falls back to the declared type when unavailable. */ + * select rendering; the host calls it with `{ locale }` (the current DBX UI + * locale) so plugins can localize the labels. Falls back to the declared + * type when unavailable. */ options_action?: string; /** Host API 1.1: offer a local-file action on this field. */ picker?: PluginFormFieldPicker; @@ -517,8 +519,10 @@ export interface PluginOpenWorkbenchAction extends PluginOpenWorkbenchTarget { /** * Generic launch-options extension point: sidecar method returning * `{ entries: [{ label, description?, context? }] }` for the dock "+" picker. - * The host renders labels and merges the chosen context into the - * host-authored panel context — never interpreting the business meaning. + * The host calls it with `{ locale }` (the current DBX UI locale, e.g. + * "en"/"zh-CN") so plugins can localize the returned labels, renders the + * labels and merges the chosen context into the host-authored panel + * context — never interpreting the business meaning. */ options_action?: string; /** When true, the host also offers the plugin's own saved connections as launch targets. */