You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/12 18:58:59 UTC
(maka) branch main updated: refactor(desktop): type the main-process copy tables as catalogs (#5178)
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/main by this push:
new e70c97bdb9 refactor(desktop): type the main-process copy tables as catalogs (#5178)
e70c97bdb9 is described below
commit e70c97bdb92a53550bb8b92ea3363c4fb7bd30b8
Author: NekoPunch <95...@users.noreply.github.com>
AuthorDate: Sat Sep 12 11:58:54 2026 -0700
refactor(desktop): type the main-process copy tables as catalogs (#5178)
Four trilingual tables in the main process were plain object literals, so
a missing locale or a key present in one language only was a runtime
surprise rather than a compile error. Declaring the shape and applying
`satisfies UiCatalog<T>` makes drift a type error, matching the renderer
catalogs and the main-process tables that already do this.
No copy changes.
Generated-by: Claude Code
---
apps/desktop/src/main/runtime-host-quit-copy.ts | 12 ++++++++++--
apps/desktop/src/main/runtime-host-wsl-handoff.ts | 12 ++++++++++--
apps/desktop/src/main/startup-progress-window.ts | 15 +++++++++++++--
apps/desktop/src/main/windows-app-tray.ts | 9 ++++++++-
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/apps/desktop/src/main/runtime-host-quit-copy.ts b/apps/desktop/src/main/runtime-host-quit-copy.ts
index 9b316e77a6..4fd7bb5839 100644
--- a/apps/desktop/src/main/runtime-host-quit-copy.ts
+++ b/apps/desktop/src/main/runtime-host-quit-copy.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import type { UiLocale } from '@maka/core/ui-locale';
+import type { UiCatalog, UiLocale } from '@maka/core/ui-locale';
import type { MessageBoxOptions } from 'electron';
export interface RuntimeHostQuitDialog<Decision extends string> {
@@ -46,6 +46,14 @@ export function buildRuntimeHostActiveQuitDialog(
};
}
+interface RuntimeHostQuitCopy {
+ readonly activeTitle: string;
+ readonly activeMessage: string;
+ readonly activeDetail: string;
+ readonly stopAndQuit: string;
+ readonly keepRunning: string;
+}
+
const COPY = {
en: {
activeTitle: 'Maka is still working',
@@ -71,4 +79,4 @@ const COPY = {
stopAndQuit: '停止工作並結束',
keepRunning: '繼續執行 Maka',
},
-} as const;
+} satisfies UiCatalog<RuntimeHostQuitCopy>;
diff --git a/apps/desktop/src/main/runtime-host-wsl-handoff.ts b/apps/desktop/src/main/runtime-host-wsl-handoff.ts
index e1847646ec..67cc4034b4 100644
--- a/apps/desktop/src/main/runtime-host-wsl-handoff.ts
+++ b/apps/desktop/src/main/runtime-host-wsl-handoff.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import type { UiLocale } from '@maka/core/ui-locale';
+import type { UiCatalog, UiLocale } from '@maka/core/ui-locale';
import type { EnvironmentRuntimeHostProfile, HostHandoffBlocker, HostHandoffPhase, RuntimeHostRemoteCompatibilityError } from '@maka/runtime-host/client';
import { compareProductReleaseVersions } from '@maka/runtime-host/operator';
import type { DesktopRuntimeHostManagedServiceBinding } from './runtime-host-managed-services.js';
@@ -110,6 +110,14 @@ export async function resolveDesktopWslHostHandoff(
}
+interface WslHandoffGuidance {
+ readonly client: string;
+ readonly binding: string;
+ readonly source: string;
+ readonly target: string;
+ readonly development: string;
+}
+
const GUIDANCE = {
en: {
client: 'Update Desktop to a build compatible with this Host. The Host will not be downgraded.',
@@ -132,4 +140,4 @@ const GUIDANCE = {
target: '目前 Desktop 無法驗證合適的替換套件。請更新 Desktop,或透過開發環境明確管理選定的開發套件;現有 Host 會被保留。',
development: '選定的開發構建',
},
-} as const;
+} satisfies UiCatalog<WslHandoffGuidance>;
diff --git a/apps/desktop/src/main/startup-progress-window.ts b/apps/desktop/src/main/startup-progress-window.ts
index 1634e69532..448e53b77b 100644
--- a/apps/desktop/src/main/startup-progress-window.ts
+++ b/apps/desktop/src/main/startup-progress-window.ts
@@ -19,7 +19,7 @@
import { randomUUID } from 'node:crypto';
import { MAKA_WORDMARK_PATH } from '@maka/core/maka-wordmark';
-import type { UiLocale } from '@maka/core/ui-locale';
+import type { UiCatalog, UiLocale } from '@maka/core/ui-locale';
import { formatHostHandoff, type HostHandoffView, type HostHandoffAction } from '@maka/runtime-host/client';
import type { BrowserWindow, BrowserWindowConstructorOptions } from 'electron';
import { focusWindow, showWindowInactive, type WindowRevealMode } from './window-reveal.js';
@@ -29,6 +29,17 @@ export type StartupPhase =
| 'checking' | 'staging' | 'retiring' | 'replacing' | 'restart'
| 'attention' | 'renderer';
+interface StartupProgressCopy {
+ readonly title: string;
+ readonly detail: string;
+ readonly slow: string;
+ readonly copy: string;
+ readonly copied: string;
+ readonly copyFailed: string;
+ readonly elapsed: string;
+ readonly phases: Record<StartupPhase, string>;
+}
+
const COPY = {
en: {
title: 'Opening your workspace',
@@ -68,7 +79,7 @@ const COPY = {
attention: '等待你的確認', renderer: '正在開啟工作區',
},
},
-} as const;
+} satisfies UiCatalog<StartupProgressCopy>;
export interface StartupProgressWindow {
update(phase: StartupPhase): void;
diff --git a/apps/desktop/src/main/windows-app-tray.ts b/apps/desktop/src/main/windows-app-tray.ts
index d3bc8aec5b..66762db569 100644
--- a/apps/desktop/src/main/windows-app-tray.ts
+++ b/apps/desktop/src/main/windows-app-tray.ts
@@ -18,6 +18,7 @@
*/
import type { Menu, MenuItemConstructorOptions, Tray } from 'electron';
+import type { UiCatalog } from '@maka/core/ui-locale';
import type { DesktopLocaleAuthority } from './desktop-locale-authority.js';
type TraySurface = Pick<Tray, 'setToolTip' | 'setContextMenu' | 'on' | 'destroy' | 'isDestroyed'>;
@@ -33,11 +34,17 @@ interface WindowsAppTrayDeps {
onError(error: unknown): void;
}
+interface WindowsAppTrayCopy {
+ readonly open: string;
+ readonly workHub: string;
+ readonly quit: string;
+}
+
const copy = {
en: { open: 'Open Maka', workHub: 'Open WorkHub', quit: 'Quit Maka' },
'zh-CN': { open: '打开 Maka', workHub: '打开 WorkHub', quit: '退出 Maka' },
'zh-TW': { open: '開啟 Maka', workHub: '開啟 WorkHub', quit: '結束 Maka' },
-};
+} satisfies UiCatalog<WindowsAppTrayCopy>;
/** Windows needs a visible way back after the last product window closes. */
export function createWindowsAppTray(deps: WindowsAppTrayDeps) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org