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(desktop): 设置页 LSP 代码智能卡片补全四语言 i18n 词条 (#367)

zhanghengxd62c8d83e493f
diff --git a/apps/desktop/src/renderer/__tests__/i18nCompleteness.test.ts b/apps/desktop/src/renderer/__tests__/i18nCompleteness.test.ts
index b43c601ee6..839d05d9ea 100644
--- a/apps/desktop/src/renderer/__tests__/i18nCompleteness.test.ts
+++ b/apps/desktop/src/renderer/__tests__/i18nCompleteness.test.ts
@@ -31,10 +31,6 @@ const KNOWN_MISSING: ReadonlySet<string> = new Set([
'ccAgent.workdirBrowse.fileBody.drawioLoading',
'ccAgent.workdirBrowse.fileBody.pdfLoading',
'chat.media.clickToZoom',
- 'settings.lspMode.cell.description',
- 'settings.lspMode.cell.title',
- 'settings.lspMode.toast.toggleFailed',
- 'settings.lspMode.toggleAria',
]);
function loadLocales(): Record<string, unknown>[] {
diff --git a/apps/desktop/src/renderer/components/settings/LspBetaCell.tsx b/apps/desktop/src/renderer/components/settings/LspBetaCell.tsx
index 8646ef7a07..ed150e82b7 100644
--- a/apps/desktop/src/renderer/components/settings/LspBetaCell.tsx
+++ b/apps/desktop/src/renderer/components/settings/LspBetaCell.tsx
@@ -39,25 +39,16 @@ export function LspBetaCell() {
try {
await window.electronAPI.maker.lspModeSet(next);
toast.success(
- t(
- next
- ? 'settings.lspMode.toast.enabled'
- : 'settings.lspMode.toast.disabled',
- {
- defaultValue: next
- ? 'LSP 已开启,新建 session 后生效'
- : 'LSP 已关闭,新建 session 后生效',
- },
- ),
+ next
+ ? t('settings.lspMode.toast.enabled')
+ : t('settings.lspMode.toast.disabled'),
);
} catch (err) {
log.warn('lspModeSet failed', err);
toast.error(
err instanceof Error
? err.message
- : t('settings.lspMode.toast.toggleFailed', {
- defaultValue: '切换 LSP 开关失败',
- }),
+ : t('settings.lspMode.toast.toggleFailed'),
);
setEnabled(prev);
} finally {
@@ -67,15 +58,8 @@ export function LspBetaCell() {
[enabled, setEnabled, t],
);
- const title = t('settings.lspMode.cell.title', {
- defaultValue: '代码智能 (LSP) · Beta',
- });
- const description = t('settings.lspMode.cell.description', {
- defaultValue:
- '通过 typescript-language-server 给 agent 提供精确的符号引用、跳转、call hierarchy。' +
- '仅在 TypeScript 项目里生效 (自动检测 tsconfig.json / package.json 依赖)。' +
- '非 TS 项目里此开关无效果,agent 工具列表不会出现 lsp_*。',
- });
+ const title = t('settings.lspMode.cell.title');
+ const description = t('settings.lspMode.cell.description');
return (
<div
@@ -102,9 +86,7 @@ export function LspBetaCell() {
checked={enabled}
disabled={pending}
onCheckedChange={(v) => void handleToggle(v)}
- aria-label={t('settings.lspMode.toggleAria', {
- defaultValue: 'LSP 代码智能开关',
- })}
+ aria-label={t('settings.lspMode.toggleAria')}
/>
</div>
</div>
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index e83236b629..1003a4bf4e 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -1332,6 +1332,18 @@
"toggleAria": "Toggle experimental feature: {{title}}",
"features": {}
},
+ "lspMode": {
+ "cell": {
+ "title": "Code Intelligence (LSP) · Beta",
+ "description": "Gives the agent precise symbol references, go-to-definition, and call hierarchy via typescript-language-server. Only takes effect in TypeScript projects (auto-detected from tsconfig.json / package.json dependencies). In non-TS projects this switch does nothing and lsp_* tools won't appear in the agent's tool list."
+ },
+ "toggleAria": "Toggle LSP code intelligence",
+ "toast": {
+ "enabled": "LSP enabled — takes effect in new sessions",
+ "disabled": "LSP disabled — takes effect in new sessions",
+ "toggleFailed": "Failed to toggle LSP"
+ }
+ },
"gitSafety": {
"title": "Git Safety",
"autoSnapshotTitle": "Git safety snapshots",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 29c626b1ee..198f3140e2 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -1331,6 +1331,18 @@
"toggleAria": "実験的機能を切り替え: {{title}}",
"features": {}
},
+ "lspMode": {
+ "cell": {
+ "title": "コードインテリジェンス (LSP) · Beta",
+ "description": "typescript-language-server を通じて、エージェントに正確なシンボル参照・定義ジャンプ・コールヒエラルキーを提供します。TypeScript プロジェクトでのみ有効です (tsconfig.json / package.json の依存関係を自動検出)。TS 以外のプロジェクトではこのスイッチは効果がなく、エージェントのツール一覧に lsp_* は表示されません。"
+ },
+ "toggleAria": "LSP コードインテリジェンスを切り替え",
+ "toast": {
+ "enabled": "LSP を有効にしました。新しいセッションから反映されます",
+ "disabled": "LSP を無効にしました。新しいセッションから反映されます",
+ "toggleFailed": "LSP の切り替えに失敗しました"
+ }
+ },
"gitSafety": {
"title": "Git セーフティ",
"autoSnapshotTitle": "Git セーフティ保存点",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 5c93dce9d4..3dad3b6864 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -1331,6 +1331,18 @@
"toggleAria": "실험적 기능 전환: {{title}}",
"features": {}
},
+ "lspMode": {
+ "cell": {
+ "title": "코드 인텔리전스 (LSP) · Beta",
+ "description": "typescript-language-server를 통해 에이전트에 정확한 심볼 참조, 정의 이동, 호출 계층(call hierarchy)을 제공합니다. TypeScript 프로젝트에서만 동작합니다(tsconfig.json / package.json 의존성 자동 감지). TS 프로젝트가 아니면 이 스위치는 효과가 없으며 에이전트 도구 목록에 lsp_*가 표시되지 않습니다."
+ },
+ "toggleAria": "LSP 코드 인텔리전스 전환",
+ "toast": {
+ "enabled": "LSP가 활성화되었습니다. 새 세션부터 적용됩니다",
+ "disabled": "LSP가 비활성화되었습니다. 새 세션부터 적용됩니다",
+ "toggleFailed": "LSP 전환에 실패했습니다"
+ }
+ },
"gitSafety": {
"title": "Git 안전",
"autoSnapshotTitle": "Git 안전 저장점",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 914013acc1..c52ce82300 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -1331,6 +1331,18 @@
"toggleAria": "切换实验功能:{{title}}",
"features": {}
},
+ "lspMode": {
+ "cell": {
+ "title": "代码智能 (LSP) · Beta",
+ "description": "通过 typescript-language-server 给 agent 提供精确的符号引用、跳转、call hierarchy。仅在 TypeScript 项目里生效 (自动检测 tsconfig.json / package.json 依赖)。非 TS 项目里此开关无效果,agent 工具列表不会出现 lsp_*。"
+ },
+ "toggleAria": "LSP 代码智能开关",
+ "toast": {
+ "enabled": "LSP 已开启,新建 session 后生效",
+ "disabled": "LSP 已关闭,新建 session 后生效",
+ "toggleFailed": "切换 LSP 开关失败"
+ }
+ },
"gitSafety": {
"title": "Git 安全",
"autoSnapshotTitle": "Git 安全保存点",