Skip to content
104 changes: 77 additions & 27 deletions apps/desktop/renderer-architecture.json
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/artifact-copy.ts": {
"bridgePaths": {},
Expand All @@ -1097,7 +1099,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/browser-copy.ts": {
"bridgePaths": {},
Expand All @@ -1106,7 +1110,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/capability-reason-copy.ts": {
"bridgePaths": {},
Expand All @@ -1126,7 +1132,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/mcp-copy.ts": {
"bridgePaths": {},
Expand All @@ -1135,7 +1143,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/onboarding-copy.ts": {
"bridgePaths": {},
Expand All @@ -1144,7 +1154,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/peer-mesh-copy.ts": {
"bridgePaths": {},
Expand All @@ -1153,7 +1165,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/permission-center-copy.ts": {
"bridgePaths": {},
Expand All @@ -1162,7 +1176,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/plan-mode-copy.ts": {
"bridgePaths": {},
Expand All @@ -1182,7 +1198,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/session-local-copy.ts": {
"bridgePaths": {},
Expand All @@ -1191,7 +1209,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-bot-copy.ts": {
"bridgePaths": {},
Expand All @@ -1211,7 +1231,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-data-copy.ts": {
"bridgePaths": {},
Expand All @@ -1220,7 +1242,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-external-agents-copy.ts": {
"bridgePaths": {},
Expand All @@ -1229,7 +1253,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-health-copy.ts": {
"bridgePaths": {},
Expand All @@ -1238,7 +1264,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-jev-copy.ts": {
"bridgePaths": {},
Expand All @@ -1247,7 +1275,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-memory-copy.ts": {
"bridgePaths": {},
Expand All @@ -1267,7 +1297,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-preferences-copy.ts": {
"bridgePaths": {},
Expand All @@ -1276,7 +1308,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-projects-copy.ts": {
"bridgePaths": {},
Expand All @@ -1296,7 +1330,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-subagents-copy.ts": {
"bridgePaths": {},
Expand All @@ -1305,7 +1341,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-tasks-copy.ts": {
"bridgePaths": {},
Expand All @@ -1314,7 +1352,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-test-result-copy.ts": {
"bridgePaths": {},
Expand All @@ -1324,7 +1364,7 @@
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {
"@maka/core/ui-locale": 1
"@maka/core/ui-locale": 2
}
},
"src/renderer/locales/settings-usage-copy.ts": {
Expand All @@ -1334,7 +1374,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/settings-web-search-copy.ts": {
"bridgePaths": {},
Expand All @@ -1343,7 +1385,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/shell-copy.ts": {
"bridgePaths": {},
Expand All @@ -1365,7 +1409,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/storage-usage-copy.ts": {
"bridgePaths": {},
Expand All @@ -1374,7 +1420,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/task-readiness-copy.ts": {
"bridgePaths": {},
Expand All @@ -1383,7 +1431,9 @@
"lifecycleMethods": {},
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {}
"dependencyPaths": {
"@maka/core/ui-locale": 1
}
},
"src/renderer/locales/work-board-error-copy.ts": {
"bridgePaths": {},
Expand All @@ -1393,7 +1443,7 @@
"unresolvedDependencies": 0,
"actionFactories": [],
"dependencyPaths": {
"@maka/core/ui-locale": 1
"@maka/core/ui-locale": 2
}
},
"src/renderer/model-catalog-choices.ts": {
Expand Down
14 changes: 7 additions & 7 deletions apps/desktop/src/main/__tests__/bot-chat-detail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { pathToFileURL } from 'node:url';
import { createDefaultBotChannel } from '@maka/core/bot-chat-settings';
import { MAX_ALLOWED_USER_IDS, createDefaultSettings } from '@maka/core/settings';
import { BotRegistry, SlackBotBridge, WechatBridge, type BotStatus } from '@maka/runtime/bots';
import { UI_LOCALES, type UiCatalog, type UiLocale } from '@maka/core/ui-locale';
import { UI_LOCALES, type UiLocale, defineUiMessageCatalog, resolveUiMessageCatalog } from '@maka/core/ui-locale';
import { AstryxLocaleProvider, LocaleProvider, ToastProvider } from '@maka/ui';
import { build } from 'esbuild';
import { parseHTML } from 'linkedom';
Expand Down Expand Up @@ -69,7 +69,11 @@ after(async () => {
});

const invalidUsers = ['@alice', '@bob', '@carol', '@dave', '@eve'];
const expectedCopy = {
const expectedCopy = resolveUiMessageCatalog(defineUiMessageCatalog<{
help: string;
cappedHelp: string;
warnings: [number, string][];
}>()({
'zh-CN': {
help: 'Telegram 用户 ID 是 64 位整数;填入后只接收列表里这些 ID 的来信,其它人发的消息会被静默忽略(不会回弹任何提示)。',
cappedHelp: 'Telegram 用户 ID 是 64 位整数;填入后只接收列表里这些 ID 的来信,其它人发的消息会被静默忽略(不会回弹任何提示)。 (已达到上限)',
Expand Down Expand Up @@ -100,11 +104,7 @@ const expectedCopy = {
[5, 'These entries are not numeric IDs and may be usernames, so they will not match anyone: @alice, @bob, @carol and 2 more'],
],
},
} satisfies UiCatalog<{
help: string;
cappedHelp: string;
warnings: [number, string][];
}>;
}));

for (const locale of UI_LOCALES) {
const expected = expectedCopy[locale];
Expand Down
12 changes: 6 additions & 6 deletions apps/desktop/src/main/__tests__/health-center-copy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { CAPABILITY_REASON_CODES } from '@maka/core/capabilities';
import { UI_LOCALES, type UiCatalog } from '@maka/core/ui-locale';
import { UI_LOCALES, defineUiMessageCatalog, resolveUiMessageCatalog } from '@maka/core/ui-locale';
import { connectionLastTestMessageDisplay } from '../../renderer/features/connection-settings/index.js';
import { getHealthCenterCopy } from '../../renderer/locales/settings-health-copy.js';
import { getCapabilityReasonCopy } from '../../renderer/locales/capability-reason-copy.js';
Expand Down Expand Up @@ -100,11 +100,11 @@ test('renders runtime probe details from structured params, not string parsing',
});

test('capability reason codes have copy in every locale, unknown reasons keep the fallback', () => {
const fallback = {
'zh-CN': '状态详情请见对应设置页。',
'zh-TW': '狀態詳細資料請參閱對應的設定頁。',
en: 'See the corresponding settings page for details.',
} satisfies UiCatalog<string>;
const fallback = resolveUiMessageCatalog(defineUiMessageCatalog<string>()({
'zh-CN': '状态详情请见对应设置页。',
'zh-TW': '狀態詳細資料請參閱對應的設定頁。',
en: 'See the corresponding settings page for details.',
}));
assert.equal(getCapabilityReasonCopy('zh-CN').platform_credentials_missing, '未配置平台凭据');
for (const locale of UI_LOCALES) {
const reasons = getCapabilityReasonCopy(locale);
Expand Down
20 changes: 10 additions & 10 deletions apps/desktop/src/main/__tests__/settings-memory-copy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import assert from 'node:assert/strict';
import test from 'node:test';
import { UI_LOCALES, type UiCatalog } from '@maka/core/ui-locale';
import { UI_LOCALES, defineUiMessageCatalog, resolveUiMessageCatalog } from '@maka/core/ui-locale';
import {
getMemorySettingsCopy,
memoryResultMessage,
Expand Down Expand Up @@ -51,7 +51,14 @@ test('falls back for an unknown Runtime Host memory rejection code', () => {
}
});

const formattedCopy = {
const formattedCopy = resolveUiMessageCatalog(defineUiMessageCatalog<{
counts: string[][];
summaries: string[][];
redacted: string[];
backupFailures: string[];
preview: string[];
labels: string[];
}>()({
'zh-CN': {
counts: [
['0 条生效', '草稿 0 条生效', '0 条已归档', '草稿 0 条已归档', '0 条记忆'],
Expand Down Expand Up @@ -145,14 +152,7 @@ const formattedCopy = {
'The current MEMORY.md will be backed up before the selected backup replaces it. Restore: Backup #2',
],
},
} satisfies UiCatalog<{
counts: string[][];
summaries: string[][];
redacted: string[];
backupFailures: string[];
preview: string[];
labels: string[];
}>;
}));

for (const locale of UI_LOCALES) {
const expected = formattedCopy[locale];
Expand Down
Loading