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

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

View File

@@ -101,21 +101,6 @@ type Model = {
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
*
@@ -141,38 +126,54 @@ const FloatingPromptInputInner = (
) => {
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
const THINKING_MODES: ThinkingModeConfig[] = [
{
id: "auto",
name: "Auto",
name: t('messages.auto'),
description: t('messages.letClaudeDecide'),
level: 0
},
{
id: "think",
name: "Think",
name: t('messages.think'),
description: t('messages.basicReasoning'),
level: 1,
phrase: "think"
},
{
id: "think_hard",
name: "Think Hard",
name: t('messages.thinkHard'),
description: t('messages.deeperAnalysis'),
level: 2,
phrase: "think hard"
},
{
id: "think_harder",
name: "Think Harder",
name: t('messages.thinkHarder'),
description: t('messages.extensiveReasoning'),
level: 3,
phrase: "think harder"
},
{
id: "ultrathink",
name: "Ultrathink",
name: t('messages.ultrathink'),
description: t('messages.maximumAnalysis'),
level: 4,
phrase: "ultrathink"
@@ -738,7 +739,7 @@ const FloatingPromptInputInner = (
onClick={(e) => e.stopPropagation()}
>
<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
variant="ghost"
size="icon"
@@ -788,7 +789,7 @@ const FloatingPromptInputInner = (
</div>
<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
trigger={
<TooltipProvider>
@@ -807,7 +808,7 @@ const FloatingPromptInputInner = (
</Button>
</TooltipTrigger>
<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>
</TooltipContent>
</Tooltip>
@@ -957,7 +958,7 @@ const FloatingPromptInputInner = (
</Button>
</TooltipTrigger>
<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>
</TooltipContent>
</Tooltip>

View File

@@ -245,9 +245,9 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
if (cmd.scope === "user") {
key = cmd.namespace ? `${t('slashCommands.userCommands')}: ${cmd.namespace}` : t('slashCommands.userCommands');
} 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 {
key = cmd.namespace || "Commands";
key = cmd.namespace || t('slashCommands.commands');
}
if (!acc[key]) {
@@ -477,7 +477,7 @@ export const SlashCommandPicker: React.FC<SlashCommandPickerProps> = ({
<div key={groupKey}>
<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("Project Commands") && <Building2 className="h-3 w-3" />}
{groupKey.startsWith(t('slashCommands.projectCommands')) && <Building2 className="h-3 w-3" />}
{groupKey}
</h3>

View File

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

View File

@@ -213,6 +213,8 @@
"project": "Project",
"user": "User",
"userCommands": "User Commands",
"projectCommands": "Project Commands",
"commands": "Commands",
"manageProjectCommands": "Manage project-specific slash commands for",
"noCommandsFound": "No commands found",
"noProjectCommandsYet": "No project commands created yet",
@@ -661,6 +663,12 @@
"deeperAnalysis": "Deeper analysis",
"extensiveReasoning": "Extensive reasoning",
"maximumAnalysis": "Maximum analysis",
"thinking": "Thinking",
"auto": "Auto",
"think": "Think",
"thinkHard": "Think Hard",
"thinkHarder": "Think Harder",
"ultrathink": "Ultrathink",
"typeYourPromptHere": "Type your prompt here...",
"dropImagesHere": "Drop images here...",
"askClaudeAnything": "Ask Claude anything...",
@@ -759,7 +767,8 @@
},
"input": {
"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": {
"title": "Relay Stations",

View File

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