优化页面,国际化细节内容

This commit is contained in:
2025-08-09 04:42:10 +08:00
parent f682dd7a5b
commit c5b72a9879
6 changed files with 95 additions and 52 deletions

View File

@@ -8,6 +8,7 @@ import {
ChevronDown, ChevronDown,
GitBranch, GitBranch,
Settings, Settings,
Settings2,
ChevronUp, ChevronUp,
X, X,
Hash, Hash,
@@ -1280,26 +1281,44 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{projectPath && onProjectSettings && ( {projectPath && onProjectSettings && (
<Button <TooltipProvider>
variant="outline" <Tooltip>
size="sm" <TooltipTrigger asChild>
onClick={() => onProjectSettings(projectPath)} <Button
disabled={isLoading} variant="ghost"
> size="icon"
<Settings className="h-4 w-4 mr-2" /> onClick={() => onProjectSettings(projectPath)}
Hooks disabled={isLoading}
</Button> className="h-8 w-8"
>
<Settings2 className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t('agents.hooks')}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
)} )}
{projectPath && ( {projectPath && (
<Button <TooltipProvider>
variant="outline" <Tooltip>
size="sm" <TooltipTrigger asChild>
onClick={() => setShowSlashCommandsSettings(true)} <Button
disabled={isLoading} variant="ghost"
> size="icon"
<Command className="h-4 w-4 mr-2" /> onClick={() => setShowSlashCommandsSettings(true)}
Commands disabled={isLoading}
</Button> className="h-8 w-8"
>
<Command className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t('app.commands')}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
)} )}
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<TooltipProvider> <TooltipProvider>
@@ -1698,7 +1717,7 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
<Dialog open={showSlashCommandsSettings} onOpenChange={setShowSlashCommandsSettings}> <Dialog open={showSlashCommandsSettings} onOpenChange={setShowSlashCommandsSettings}>
<DialogContent className="max-w-4xl max-h-[80vh] overflow-hidden"> <DialogContent className="max-w-4xl max-h-[80vh] overflow-hidden">
<DialogHeader> <DialogHeader>
<DialogTitle>Slash Commands</DialogTitle> <DialogTitle>{t('slashCommands.slashCommands')}</DialogTitle>
<DialogDescription> <DialogDescription>
{t('slashCommands.manageProjectCommands')} {projectPath} {t('slashCommands.manageProjectCommands')} {projectPath}
</DialogDescription> </DialogDescription>

View File

@@ -101,21 +101,6 @@ type Model = {
icon: React.ReactNode; icon: React.ReactNode;
}; };
const MODELS: Model[] = [
{
id: "sonnet",
name: "Claude 4 Sonnet",
description: "Faster, efficient for most tasks",
icon: <Zap className="h-4 w-4" />
},
{
id: "opus",
name: "Claude 4.1 Opus",
description: "More capable, better for complex tasks",
icon: <Sparkles className="h-4 w-4" />
}
];
/** /**
* FloatingPromptInput component - Fixed position prompt input with model picker * FloatingPromptInput component - Fixed position prompt input with model picker
* *
@@ -141,38 +126,54 @@ const FloatingPromptInputInner = (
) => { ) => {
const { t } = useTranslation(); const { t } = useTranslation();
// Define MODELS inside component to access translations
const MODELS: Model[] = [
{
id: "sonnet",
name: t('agents.sonnetName'),
description: t('agents.sonnetDescription'),
icon: <Zap className="h-4 w-4" />
},
{
id: "opus",
name: t('agents.opusName'),
description: t('agents.opusDescription'),
icon: <Sparkles className="h-4 w-4" />
}
];
// Define THINKING_MODES inside component to access translations // Define THINKING_MODES inside component to access translations
const THINKING_MODES: ThinkingModeConfig[] = [ const THINKING_MODES: ThinkingModeConfig[] = [
{ {
id: "auto", id: "auto",
name: "Auto", name: t('messages.auto'),
description: t('messages.letClaudeDecide'), description: t('messages.letClaudeDecide'),
level: 0 level: 0
}, },
{ {
id: "think", id: "think",
name: "Think", name: t('messages.think'),
description: t('messages.basicReasoning'), description: t('messages.basicReasoning'),
level: 1, level: 1,
phrase: "think" phrase: "think"
}, },
{ {
id: "think_hard", id: "think_hard",
name: "Think Hard", name: t('messages.thinkHard'),
description: t('messages.deeperAnalysis'), description: t('messages.deeperAnalysis'),
level: 2, level: 2,
phrase: "think hard" phrase: "think hard"
}, },
{ {
id: "think_harder", id: "think_harder",
name: "Think Harder", name: t('messages.thinkHarder'),
description: t('messages.extensiveReasoning'), description: t('messages.extensiveReasoning'),
level: 3, level: 3,
phrase: "think harder" phrase: "think harder"
}, },
{ {
id: "ultrathink", id: "ultrathink",
name: "Ultrathink", name: t('messages.ultrathink'),
description: t('messages.maximumAnalysis'), description: t('messages.maximumAnalysis'),
level: 4, level: 4,
phrase: "ultrathink" phrase: "ultrathink"
@@ -738,7 +739,7 @@ const FloatingPromptInputInner = (
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
> >
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<h3 className="text-sm font-medium">Compose your prompt</h3> <h3 className="text-sm font-medium">{t('input.composeYourPrompt')}</h3>
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
@@ -788,7 +789,7 @@ const FloatingPromptInputInner = (
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="text-xs text-muted-foreground">Thinking:</span> <span className="text-xs text-muted-foreground">{t('messages.thinking')}:</span>
<Popover <Popover
trigger={ trigger={
<TooltipProvider> <TooltipProvider>
@@ -807,7 +808,7 @@ const FloatingPromptInputInner = (
</Button> </Button>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent> <TooltipContent>
<p className="font-medium">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.name || "Auto"}</p> <p className="font-medium">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.name || t('messages.auto')}</p>
<p className="text-xs text-muted-foreground">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.description}</p> <p className="text-xs text-muted-foreground">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.description}</p>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>
@@ -957,7 +958,7 @@ const FloatingPromptInputInner = (
</Button> </Button>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent> <TooltipContent>
<p className="font-medium">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.name || "Auto"}</p> <p className="font-medium">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.name || t('messages.auto')}</p>
<p className="text-xs text-muted-foreground">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.description}</p> <p className="text-xs text-muted-foreground">{THINKING_MODES.find(m => m.id === selectedThinkingMode)?.description}</p>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>

View File

@@ -245,9 +245,9 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
if (cmd.scope === "user") { if (cmd.scope === "user") {
key = cmd.namespace ? `${t('slashCommands.userCommands')}: ${cmd.namespace}` : t('slashCommands.userCommands'); key = cmd.namespace ? `${t('slashCommands.userCommands')}: ${cmd.namespace}` : t('slashCommands.userCommands');
} else if (cmd.scope === "project") { } else if (cmd.scope === "project") {
key = cmd.namespace ? `Project Commands: ${cmd.namespace}` : "Project Commands"; key = cmd.namespace ? `${t('slashCommands.projectCommands')}: ${cmd.namespace}` : t('slashCommands.projectCommands');
} else { } else {
key = cmd.namespace || "Commands"; key = cmd.namespace || t('slashCommands.commands');
} }
if (!acc[key]) { if (!acc[key]) {
@@ -477,7 +477,7 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
<div key={groupKey}> <div key={groupKey}>
<h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider px-3 mb-1 flex items-center gap-2"> <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider px-3 mb-1 flex items-center gap-2">
{groupKey.startsWith(t('slashCommands.userCommands')) && <User className="h-3 w-3" />} {groupKey.startsWith(t('slashCommands.userCommands')) && <User className="h-3 w-3" />}
{groupKey.startsWith("Project Commands") && <Building2 className="h-3 w-3" />} {groupKey.startsWith(t('slashCommands.projectCommands')) && <Building2 className="h-3 w-3" />}
{groupKey} {groupKey}
</h3> </h3>

View File

@@ -293,7 +293,7 @@ export const SlashCommandsManager: React.FC<SlashCommandsManagerProps> = ({
const groupedCommands = filteredCommands.reduce((acc, cmd) => { const groupedCommands = filteredCommands.reduce((acc, cmd) => {
const key = cmd.namespace const key = cmd.namespace
? `${cmd.namespace} (${cmd.scope})` ? `${cmd.namespace} (${cmd.scope})`
: `${cmd.scope === 'project' ? 'Project' : 'User'} Commands`; : cmd.scope === 'project' ? t('slashCommands.projectCommands') : t('slashCommands.userCommands');
if (!acc[key]) { if (!acc[key]) {
acc[key] = []; acc[key] = [];
} }
@@ -531,7 +531,7 @@ export const SlashCommandsManager: React.FC<SlashCommandsManagerProps> = ({
<SelectItem value="user"> <SelectItem value="user">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Globe className="h-4 w-4" /> <Globe className="h-4 w-4" />
User (Global) {t('slashCommands.user')} ({t('slashCommands.globalSearch')})
</div> </div>
</SelectItem> </SelectItem>
)} )}
@@ -539,7 +539,7 @@ export const SlashCommandsManager: React.FC<SlashCommandsManagerProps> = ({
<SelectItem value="project" disabled={!projectPath}> <SelectItem value="project" disabled={!projectPath}>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<FolderOpen className="h-4 w-4" /> <FolderOpen className="h-4 w-4" />
Project {t('slashCommands.project')}
</div> </div>
</SelectItem> </SelectItem>
)} )}

View File

@@ -213,6 +213,8 @@
"project": "Project", "project": "Project",
"user": "User", "user": "User",
"userCommands": "User Commands", "userCommands": "User Commands",
"projectCommands": "Project Commands",
"commands": "Commands",
"manageProjectCommands": "Manage project-specific slash commands for", "manageProjectCommands": "Manage project-specific slash commands for",
"noCommandsFound": "No commands found", "noCommandsFound": "No commands found",
"noProjectCommandsYet": "No project commands created yet", "noProjectCommandsYet": "No project commands created yet",
@@ -661,6 +663,12 @@
"deeperAnalysis": "Deeper analysis", "deeperAnalysis": "Deeper analysis",
"extensiveReasoning": "Extensive reasoning", "extensiveReasoning": "Extensive reasoning",
"maximumAnalysis": "Maximum analysis", "maximumAnalysis": "Maximum analysis",
"thinking": "Thinking",
"auto": "Auto",
"think": "Think",
"thinkHard": "Think Hard",
"thinkHarder": "Think Harder",
"ultrathink": "Ultrathink",
"typeYourPromptHere": "Type your prompt here...", "typeYourPromptHere": "Type your prompt here...",
"dropImagesHere": "Drop images here...", "dropImagesHere": "Drop images here...",
"askClaudeAnything": "Ask Claude anything...", "askClaudeAnything": "Ask Claude anything...",
@@ -759,7 +767,8 @@
}, },
"input": { "input": {
"pressEnterToSend": "Press Enter to send, Shift+Enter for new line", "pressEnterToSend": "Press Enter to send, Shift+Enter for new line",
"withFileAndCommandSupport": ", @ to mention files, / for commands, drag & drop or paste images" "withFileAndCommandSupport": ", @ to mention files, / for commands, drag & drop or paste images",
"composeYourPrompt": "Compose your prompt"
}, },
"relayStation": { "relayStation": {
"title": "Relay Stations", "title": "Relay Stations",

View File

@@ -202,6 +202,8 @@
"project": "项目", "project": "项目",
"user": "用户", "user": "用户",
"userCommands": "用户命令", "userCommands": "用户命令",
"projectCommands": "项目命令",
"commands": "命令",
"manageProjectCommands": "管理项目特定的斜杠命令", "manageProjectCommands": "管理项目特定的斜杠命令",
"noCommandsFound": "未找到命令", "noCommandsFound": "未找到命令",
"noProjectCommandsYet": "尚未创建项目命令", "noProjectCommandsYet": "尚未创建项目命令",
@@ -593,7 +595,18 @@
"claudeCodeNotFound": "未找到 Claude Code", "claudeCodeNotFound": "未找到 Claude Code",
"selectClaudeInstallation": "选择 Claude 安装", "selectClaudeInstallation": "选择 Claude 安装",
"installClaudeCode": "安装 Claude Code", "installClaudeCode": "安装 Claude Code",
"session": "会话" "session": "会话",
"letClaudeDecide": "让 Claude 决定",
"basicReasoning": "基础推理",
"deeperAnalysis": "深度分析",
"extensiveReasoning": "广泛推理",
"maximumAnalysis": "最大化分析",
"thinking": "思考",
"auto": "自动",
"think": "思考",
"thinkHard": "深度思考",
"thinkHarder": "更深度思考",
"ultrathink": "超级思考"
}, },
"checkpoint": { "checkpoint": {
"title": "检查点", "title": "检查点",
@@ -681,7 +694,8 @@
}, },
"input": { "input": {
"pressEnterToSend": "按 Enter 发送Shift+Enter 换行", "pressEnterToSend": "按 Enter 发送Shift+Enter 换行",
"withFileAndCommandSupport": "@ 提及文件,/ 调用命令,拖拽或粘贴图片" "withFileAndCommandSupport": "@ 提及文件,/ 调用命令,拖拽或粘贴图片",
"composeYourPrompt": "编写您的提示"
}, },
"relayStation": { "relayStation": {
"title": "中转站", "title": "中转站",