mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-11 17:15:40 +08:00
Implemented comprehensive i18n translation support for the following components: 1. GitSettings.jsx - Git configuration interface 2. ApiKeysSettings.jsx - API keys settings 3. CredentialsSettings.jsx - Credentials settings (GitHub tokens) 4. TasksSettings.jsx - TaskMaster task management settings 5. ChatInterface.jsx - Chat interface (major translation work) New translation files: - src/i18n/locales/en/chat.json - English chat interface translations - src/i18n/locales/zh-CN/chat.json - Chinese chat interface translations ChatInterface.jsx translations: - Code block copy buttons (Copy, Copied, Copy code) - Message type labels (User, Error, Tool, Claude, Cursor, Codex) - Tool settings tooltip - Search result display (pattern, in, results) - Codex permission modes (Default, Accept Edits, Bypass Permissions, Plan) - Input placeholder and hint text - Keyboard shortcut hints (Ctrl+Enter/Enter modes) - Command menu button i18n configuration updates: - Registered chat namespace in config.js - Extended settings.json translations (git, apiKeys, tasks, agents, mcpServers sections) 完成以下组件的 i18n 翻译工作: 1. GitSettings.jsx - Git 配置界面 2. ApiKeysSettings.jsx - API 密钥设置 3. CredentialsSettings.jsx - 凭据设置(GitHub Token) 4. TasksSettings.jsx - TaskMaster 任务管理设置 5. ChatInterface.jsx - 聊天界面(主要翻译工作) 新增翻译文件: - src/i18n/locales/en/chat.json - 英文聊天界面翻译 - src/i18n/locales/zh-CN/chat.json - 中文聊天界面翻译 ChatInterface.jsx 翻译内容: - 代码块复制按钮 - 消息类型标签 - 工具设置提示 - 搜索结果显示 - Codex 权限模式(默认、编辑、无限制、计划模式) - 输入框占位符和提示文本 - 键盘快捷键提示 - 命令菜单按钮 更新 i18n 配置: - 在 config.js 中注册 chat 命名空间 - 扩展 settings.json 翻译(git、apiKeys、tasks、agents、mcpServers 等部分)
127 lines
4.9 KiB
JavaScript
127 lines
4.9 KiB
JavaScript
import { Button } from '../ui/button';
|
|
import { Badge } from '../ui/badge';
|
|
import { LogIn } from 'lucide-react';
|
|
import ClaudeLogo from '../ClaudeLogo';
|
|
import CursorLogo from '../CursorLogo';
|
|
import CodexLogo from '../CodexLogo';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
const agentConfig = {
|
|
claude: {
|
|
name: 'Claude',
|
|
description: 'Anthropic Claude AI assistant',
|
|
Logo: ClaudeLogo,
|
|
bgClass: 'bg-blue-50 dark:bg-blue-900/20',
|
|
borderClass: 'border-blue-200 dark:border-blue-800',
|
|
textClass: 'text-blue-900 dark:text-blue-100',
|
|
subtextClass: 'text-blue-700 dark:text-blue-300',
|
|
buttonClass: 'bg-blue-600 hover:bg-blue-700',
|
|
},
|
|
cursor: {
|
|
name: 'Cursor',
|
|
description: 'Cursor AI-powered code editor',
|
|
Logo: CursorLogo,
|
|
bgClass: 'bg-purple-50 dark:bg-purple-900/20',
|
|
borderClass: 'border-purple-200 dark:border-purple-800',
|
|
textClass: 'text-purple-900 dark:text-purple-100',
|
|
subtextClass: 'text-purple-700 dark:text-purple-300',
|
|
buttonClass: 'bg-purple-600 hover:bg-purple-700',
|
|
},
|
|
codex: {
|
|
name: 'Codex',
|
|
description: 'OpenAI Codex AI assistant',
|
|
Logo: CodexLogo,
|
|
bgClass: 'bg-gray-100 dark:bg-gray-800/50',
|
|
borderClass: 'border-gray-300 dark:border-gray-600',
|
|
textClass: 'text-gray-900 dark:text-gray-100',
|
|
subtextClass: 'text-gray-700 dark:text-gray-300',
|
|
buttonClass: 'bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600',
|
|
},
|
|
};
|
|
|
|
export default function AccountContent({ agent, authStatus, onLogin }) {
|
|
const { t } = useTranslation('settings');
|
|
const config = agentConfig[agent];
|
|
const { Logo } = config;
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div className="flex items-center gap-3 mb-4">
|
|
<Logo className="w-6 h-6" />
|
|
<div>
|
|
<h3 className="text-lg font-medium text-foreground">{config.name}</h3>
|
|
<p className="text-sm text-muted-foreground">{t(`agents.account.${agent}.description`)}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div className={`${config.bgClass} border ${config.borderClass} rounded-lg p-4`}>
|
|
<div className="space-y-4">
|
|
{/* Connection Status */}
|
|
<div className="flex items-center gap-3">
|
|
<div className="flex-1">
|
|
<div className={`font-medium ${config.textClass}`}>
|
|
{t('agents.connectionStatus')}
|
|
</div>
|
|
<div className={`text-sm ${config.subtextClass}`}>
|
|
{authStatus?.loading ? (
|
|
t('agents.authStatus.checkingAuth')
|
|
) : authStatus?.authenticated ? (
|
|
t('agents.authStatus.loggedInAs', { email: authStatus.email || t('agents.authStatus.authenticatedUser') })
|
|
) : (
|
|
t('agents.authStatus.notConnected')
|
|
)}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
{authStatus?.loading ? (
|
|
<Badge variant="secondary" className="bg-gray-100 dark:bg-gray-800">
|
|
{t('agents.authStatus.checking')}
|
|
</Badge>
|
|
) : authStatus?.authenticated ? (
|
|
<Badge variant="success" className="bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300">
|
|
{t('agents.authStatus.connected')}
|
|
</Badge>
|
|
) : (
|
|
<Badge variant="secondary" className="bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300">
|
|
{t('agents.authStatus.disconnected')}
|
|
</Badge>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="border-t border-gray-200 dark:border-gray-700 pt-4">
|
|
<div className="flex items-center justify-between">
|
|
<div>
|
|
<div className={`font-medium ${config.textClass}`}>
|
|
{authStatus?.authenticated ? t('agents.login.reAuthenticate') : t('agents.login.title')}
|
|
</div>
|
|
<div className={`text-sm ${config.subtextClass}`}>
|
|
{authStatus?.authenticated
|
|
? t('agents.login.reAuthDescription')
|
|
: t('agents.login.description', { agent: config.name })}
|
|
</div>
|
|
</div>
|
|
<Button
|
|
onClick={onLogin}
|
|
className={`${config.buttonClass} text-white`}
|
|
size="sm"
|
|
>
|
|
<LogIn className="w-4 h-4 mr-2" />
|
|
{authStatus?.authenticated ? t('agents.login.reLoginButton') : t('agents.login.button')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
{authStatus?.error && (
|
|
<div className="border-t border-gray-200 dark:border-gray-700 pt-4">
|
|
<div className="text-sm text-red-600 dark:text-red-400">
|
|
{t('agents.error', { error: authStatus.error })}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|