diff --git a/src/components/ClaudeVersionSelector.tsx b/src/components/ClaudeVersionSelector.tsx index 1cc17d1..c51d8b6 100644 --- a/src/components/ClaudeVersionSelector.tsx +++ b/src/components/ClaudeVersionSelector.tsx @@ -7,6 +7,7 @@ import { Badge } from "@/components/ui/badge"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Loader2, Terminal, Package, Check } from "lucide-react"; import { cn } from "@/lib/utils"; +import { useTranslation } from "react-i18next"; interface ClaudeVersionSelectorProps { /** @@ -52,6 +53,7 @@ export const ClaudeVersionSelector: React.FC = ({ onSave, isSaving = false, }) => { + const { t } = useTranslation(); const [installations, setInstallations] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -91,7 +93,7 @@ export const ClaudeVersionSelector: React.FC = ({ } } catch (err) { console.error("Failed to load Claude installations:", err); - setError(err instanceof Error ? err.message : "Failed to load Claude installations"); + setError(err instanceof Error ? err.message : t('settings.claudeInstallationLoadFailed')); } finally { setLoading(false); } @@ -140,7 +142,7 @@ export const ClaudeVersionSelector: React.FC = ({ return (
- No Claude Code installations found on your system. + {t('settings.noClaudeInstallations')}
); @@ -148,65 +150,60 @@ export const ClaudeVersionSelector: React.FC = ({ return (
-
- - { - const installation = installations.find(i => i.path === value); - if (installation) { - handleSelect(installation); - } - }} - > -
- {installations.map((installation) => ( - handleSelect(installation)} - > -
- -
-
- {getSourceIcon(installation.source)} - - {getSourceLabel(installation.source)} - - {installation.version && ( - - v{installation.version} - - )} - {selectedPath === installation.path && ( - - - Current - - )} -
-

- {installation.path} -

+ { + const installation = installations.find(i => i.path === value); + if (installation) { + handleSelect(installation); + } + }} + > +
+ {installations.map((installation) => ( + handleSelect(installation)} + > +
+ +
+
+ {getSourceIcon(installation.source)} + + {getSourceLabel(installation.source)} + + {installation.version && ( + + v{installation.version} + + )} + {selectedPath === installation.path && ( + + + {t('settings.current')} + + )}
+

+ {installation.path} +

- - ))} -
- -
+
+ + ))} +
+ {showSaveButton && onSave && (
@@ -218,14 +215,14 @@ export const ClaudeVersionSelector: React.FC = ({ {isSaving ? ( <> - Saving... + {t('common.saving')} ) : ( - "Save Selection" + t('settings.saveSelection') )}
)}
); -}; \ No newline at end of file +}; diff --git a/src/components/MCPAddServer.tsx b/src/components/MCPAddServer.tsx index 244fb6a..4fe20ab 100644 --- a/src/components/MCPAddServer.tsx +++ b/src/components/MCPAddServer.tsx @@ -266,14 +266,14 @@ export const MCPAddServer: React.FC = ({
setTransport(v as "stdio" | "sse")}> - - - - Stdio + + + + Stdio - - - SSE + + + SSE diff --git a/src/components/MCPManager.tsx b/src/components/MCPManager.tsx index 7297aa7..5c523bd 100644 --- a/src/components/MCPManager.tsx +++ b/src/components/MCPManager.tsx @@ -151,18 +151,18 @@ export const MCPManager: React.FC = ({ ) : (
- - - - {t('mcp.servers')} + + + + {t('mcp.servers')} - - - {t('mcp.addServer')} + + + {t('mcp.addServer')} - - - {t('mcp.importExport')} + + + {t('mcp.importExport')} diff --git a/src/components/MarkdownEditor.tsx b/src/components/MarkdownEditor.tsx index 9ffa0f9..a61f902 100644 --- a/src/components/MarkdownEditor.tsx +++ b/src/components/MarkdownEditor.tsx @@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button"; import { Toast, ToastContainer } from "@/components/ui/toast"; import { api } from "@/lib/api"; import { cn } from "@/lib/utils"; +import { useTranslation } from "react-i18next"; interface MarkdownEditorProps { /** @@ -28,6 +29,7 @@ export const MarkdownEditor: React.FC = ({ onBack, className, }) => { + const { t } = useTranslation(); const [content, setContent] = useState(""); const [originalContent, setOriginalContent] = useState(""); const [loading, setLoading] = useState(true); @@ -51,7 +53,7 @@ export const MarkdownEditor: React.FC = ({ setOriginalContent(prompt); } catch (err) { console.error("Failed to load system prompt:", err); - setError("Failed to load CLAUDE.md file"); + setError(t('markdownEditor.loadFailed')); } finally { setLoading(false); } @@ -64,11 +66,11 @@ export const MarkdownEditor: React.FC = ({ setToast(null); await api.saveSystemPrompt(content); setOriginalContent(content); - setToast({ message: "CLAUDE.md saved successfully", type: "success" }); + setToast({ message: t('markdownEditor.saveSuccess'), type: "success" }); } catch (err) { console.error("Failed to save system prompt:", err); - setError("Failed to save CLAUDE.md file"); - setToast({ message: "Failed to save CLAUDE.md", type: "error" }); + setError(t('markdownEditor.saveFailed')); + setToast({ message: t('markdownEditor.saveFailed'), type: "error" }); } finally { setSaving(false); } @@ -77,7 +79,7 @@ export const MarkdownEditor: React.FC = ({ const handleBack = () => { if (hasChanges) { const confirmLeave = window.confirm( - "You have unsaved changes. Are you sure you want to leave?" + t('markdownEditor.unsavedChanges') ); if (!confirmLeave) return; } @@ -106,7 +108,7 @@ export const MarkdownEditor: React.FC = ({

CLAUDE.md

- Edit your Claude Code system prompt + {t('markdownEditor.description')}

@@ -121,7 +123,7 @@ export const MarkdownEditor: React.FC = ({ ) : ( )} - {saving ? "Saving..." : "Save"} + {saving ? t('common.saving') : t('common.save')} diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index f878f56..b9927d2 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -432,7 +432,7 @@ export const Settings: React.FC = ({ {/* Claude Binary Path Selector */}
- +

{t('settings.claudeInstallationDesc')}

diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 8f9e733..73426dc 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -210,7 +210,12 @@ "chatRetention": "Chat Transcript Retention (days)", "chatRetentionDesc": "How long to retain chat transcripts locally (default: 30 days)", "claudeInstallation": "Claude Code Installation", + "selectClaudeInstallation": "Select Claude Code Installation", "claudeInstallationDesc": "Select which Claude Code installation to use", + "current": "Current", + "noClaudeInstallations": "No Claude Code installations found on your system", + "claudeInstallationLoadFailed": "Failed to load Claude installations", + "saveSelection": "Save Selection", "permissionRules": "Permission Rules", "permissionRulesDesc": "Control which tools Claude Code can use without manual approval", "allowRules": "Allow Rules", @@ -379,6 +384,13 @@ "auto": "Auto", "fullscreen": "Fullscreen" }, + "markdownEditor": { + "description": "Edit your Claude Code system prompt", + "loadFailed": "Failed to load CLAUDE.md file", + "saveSuccess": "CLAUDE.md saved successfully", + "saveFailed": "Failed to save CLAUDE.md", + "unsavedChanges": "You have unsaved changes. Are you sure you want to leave?" + }, "errors": { "loadProjectsFailed": "Failed to load projects. Please ensure ~/.claude directory exists.", "loadSessionsFailed": "Failed to load sessions for this project." diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index d667fac..7f50662 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -162,7 +162,6 @@ "outputCopiedAsJsonl": "输出已复制为 JSONL", "outputRefreshed": "输出已刷新", "agentExecutionCompleted": "智能体执行完成", - "queuedPrompts": "排队提示({{count}})", "scrollToTop": "滚动到顶部", "scrollToBottom": "滚动到底部", "tokens": "标记", @@ -231,7 +230,12 @@ "chatRetention": "聊天记录保留期(天)", "chatRetentionDesc": "本地保留聊天记录的时长(默认:30天)", "claudeInstallation": "Claude Code 安装", + "selectClaudeInstallation": "选择 Claude Code 安装", "claudeInstallationDesc": "选择要使用的 Claude Code 安装", + "current": "当前", + "noClaudeInstallations": "在您的系统上未找到 Claude Code 安装", + "claudeInstallationLoadFailed": "加载 Claude 安装失败", + "saveSelection": "保存选择", "permissionRules": "权限规则", "permissionRulesDesc": "控制 Claude Code 无需手动批准即可使用的工具", "allowRules": "允许规则", @@ -268,11 +272,17 @@ "modelNameDesc": "自定义模型名称", "costWarningsDesc": "禁用成本警告 (1)" }, + "markdownEditor": { + "description": "编辑您的 Claude Code 系统提示", + "loadFailed": "加载 CLAUDE.md 文件失败", + "saveSuccess": "CLAUDE.md 保存成功", + "saveFailed": "保存 CLAUDE.md 失败", + "unsavedChanges": "您有未保存的更改。确定要离开吗?" + }, "mcp": { "title": "MCP 服务器", "description": "管理 Model Context Protocol 服务器", "servers": "服务器", - "addServer": "添加服务器", "importExport": "导入/导出", "configuredServers": "已配置的服务器", "running": "运行中",