Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(i18n): 刷新移动端任务文案

davidf127ee1318b3
diff --git a/apps/mobile/app/devices/[deviceId].tsx b/apps/mobile/app/devices/[deviceId].tsx
index 06cdaf68e4..6e9d1422ac 100644
--- a/apps/mobile/app/devices/[deviceId].tsx
+++ b/apps/mobile/app/devices/[deviceId].tsx
@@ -356,7 +356,17 @@ export default function DeviceDetailScreen() {
// 展开,与首页交互一致);自动化任务作用域页本身就是"某任务的全部运行",必须平铺不折叠。
groupAutomations: !automationScopeKey,
}),
- [automationScopeKey, messagePreviewIndex, pendingInteractionIndex, scheduleIndex, searchQuery, sessions, statusFilter, t],
+ [
+ automationScopeKey,
+ i18nInstance.language,
+ messagePreviewIndex,
+ pendingInteractionIndex,
+ scheduleIndex,
+ searchQuery,
+ sessions,
+ statusFilter,
+ t,
+ ],
);
const displaySections = useMemo(() => {
if (automationScopeKey || !shouldReplaceListWithSearchResults(searchQuery, indexedSearch.status)) {
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index d40a465811..0307ae5948 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -2031,12 +2031,12 @@ export default function SessionScreen() {
// 写编排只读 reason(fork/rewind、队列编辑、会话设置写、pending interaction):对 lead + worker 都返回。
const collaborationReadOnlyReason = useMemo(
() => sessionCollaborationReadOnlyReason(currentSession),
- [currentSession?.orcaRole],
+ [currentSession?.orcaRole, i18nInstance.language],
);
// composer(发消息)只读 reason:仅非 lead 的协作角色只读;Lead 返回 null → 可在手机上发文字消息。
const composerReadOnlyReason = useMemo(
() => sessionCollaborationComposerReadOnlyReason(currentSession),
- [currentSession?.orcaRole],
+ [currentSession?.orcaRole, i18nInstance.language],
);
const activePendingInteraction = useMemo(() => {
return selectPendingInteractionByRequestId(pending, pendingInteractionActiveRequestId);
@@ -2075,7 +2075,7 @@ export default function SessionScreen() {
const pendingInteractionBlocksComposer = pendingInteractionsBlockRemoteComposer(pending);
const remoteUnavailableReason = useMemo(
() => describeRemoteError(connectionError),
- [connectionError],
+ [connectionError, i18nInstance.language],
);
// 自动恢复类错误只影响 outbox 派发,不锁 composer;确定性错误(撤权、关闭远程
// 控制、版本不兼容等)仍按原规则禁发。连接 issue 沿用 banner 的 active 判定,
diff --git a/apps/mobile/src/__tests__/mobilePresentationRefresh.test.ts b/apps/mobile/src/__tests__/mobilePresentationRefresh.test.ts
index 9186c09917..987bb13756 100644
--- a/apps/mobile/src/__tests__/mobilePresentationRefresh.test.ts
+++ b/apps/mobile/src/__tests__/mobilePresentationRefresh.test.ts
@@ -59,6 +59,23 @@ describe('mobile localized presentation refresh', () => {
expect(source).toContain('[i18nInstance.language, selectedSessions]');
});
+ it('rebuilds remote and collaboration notices when the language changes', () => {
+ const source = read('app/sessions/[sessionId].tsx');
+
+ expect(source).toContain('[connectionError, i18nInstance.language]');
+ expect(source.match(/\[currentSession\?\.orcaRole, i18nInstance\.language\]/g)).toHaveLength(2);
+ });
+
+ it('rebuilds localized session sections when the language changes', () => {
+ const source = read('app/devices/[deviceId].tsx');
+ const sectionProjection = source.slice(
+ source.indexOf('const sections = useMemo'),
+ source.indexOf('const listContext = useMemo'),
+ );
+
+ expect(sectionProjection).toContain('i18nInstance.language');
+ });
+
it('rebuilds file metadata when the language changes', () => {
const source = read('app/files/[sessionId].tsx');
diff --git a/apps/mobile/src/i18n/locales/en/devices.json b/apps/mobile/src/i18n/locales/en/devices.json
index ea638ace8a..687a4001b8 100644
--- a/apps/mobile/src/i18n/locales/en/devices.json
+++ b/apps/mobile/src/i18n/locales/en/devices.json
@@ -49,7 +49,7 @@
}
},
"sessionList": {
- "section": { "pinned": "Pinned" },
+ "section": { "pinned": "Pinned", "dialogue": "Chat" },
"filterWithCount": "{{label}} {{count}}",
"controlsSummary": "{{filter}} · Grouped by {{group}}",
"automation": "Automation",
diff --git a/apps/mobile/src/i18n/locales/ja/devices.json b/apps/mobile/src/i18n/locales/ja/devices.json
index 932406e852..350677dbc2 100644
--- a/apps/mobile/src/i18n/locales/ja/devices.json
+++ b/apps/mobile/src/i18n/locales/ja/devices.json
@@ -49,7 +49,7 @@
}
},
"sessionList": {
- "section": { "pinned": "ピン留め" },
+ "section": { "pinned": "ピン留め", "dialogue": "会話" },
"filterWithCount": "{{label}} {{count}}",
"controlsSummary": "{{filter}} · {{group}}別にグループ化",
"automation": "自動化",
diff --git a/apps/mobile/src/i18n/locales/ko/devices.json b/apps/mobile/src/i18n/locales/ko/devices.json
index bc1dbaa9e1..973ec5df2d 100644
--- a/apps/mobile/src/i18n/locales/ko/devices.json
+++ b/apps/mobile/src/i18n/locales/ko/devices.json
@@ -49,7 +49,7 @@
}
},
"sessionList": {
- "section": { "pinned": "고정됨" },
+ "section": { "pinned": "고정됨", "dialogue": "대화" },
"filterWithCount": "{{label}} {{count}}",
"controlsSummary": "{{filter}} · {{group}}별 그룹",
"automation": "자동화",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/devices.json b/apps/mobile/src/i18n/locales/zh-CN/devices.json
index eedea8022d..2c3a634f22 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/devices.json
@@ -49,7 +49,7 @@
}
},
"sessionList": {
- "section": { "pinned": "置顶" },
+ "section": { "pinned": "置顶", "dialogue": "对话" },
"filterWithCount": "{{label}} {{count}}",
"controlsSummary": "{{filter}} · 按{{group}}分组",
"automation": "自动化",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/devices.json b/apps/mobile/src/i18n/locales/zh-TW/devices.json
index 5ffc5ceeb9..6e9d0ab7ff 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/devices.json
@@ -49,7 +49,7 @@
}
},
"sessionList": {
- "section": { "pinned": "置頂" },
+ "section": { "pinned": "置頂", "dialogue": "對話" },
"filterWithCount": "{{label}} {{count}}",
"controlsSummary": "{{filter}} · 依{{group}}分組",
"automation": "自動化",
diff --git a/apps/mobile/src/session/sessionList.ts b/apps/mobile/src/session/sessionList.ts
index 1fb76c3250..10215889d7 100644
--- a/apps/mobile/src/session/sessionList.ts
+++ b/apps/mobile/src/session/sessionList.ts
@@ -20,7 +20,11 @@ export function buildRemoteSessionSections(
): RemoteSessionSection[] {
return buildRemoteSessionSectionsShared(sessions, now, options).map((section) => ({
...section,
- title: section.key === 'pinned' ? i18n.t('devices.presentation.sessionList.section.pinned') : section.title,
+ title: section.key === 'pinned'
+ ? i18n.t('devices.presentation.sessionList.section.pinned')
+ : section.key === 'dialogue'
+ ? i18n.t('devices.presentation.sessionList.section.dialogue')
+ : section.title,
data: section.data.map((item) => localizeRemoteSessionListItem(item, now)),
}));
}