refactor(i18n): U36 全量 JSX 属性 + toast 硬编码中文清零 — 20 文件 30 处 → 0

清理 23 处 JSX 属性 (title/placeholder/label/description) + 7 处 toast 调用硬编码中文:
- Deploy 模块 (AppRelease/DeployCredentials/PipelineManager/WorkspaceTermDialog/CredFormDialog/JobRoleCreateDialog/PipelineCreateDialog/AdvancedSettingsPanel)
- Server 模块 (ServerForm)
- System 模块 (LdapManagementSection/LiveMonitorDialog/SystemManager)
- Audit 模块 (ActiveSessionsPanel/HistorySessionsPanel)
- Monitor 模块 (AlertRulesTab/PrometheusDatasourceManager/SNMPMonitor)
- AIOps 模块 (PredictiveCapacityTab)
- Common/UI (TerminalLoadingOverlay/copy-button)

新增 25 翻译键 (common.connectingEllipsis/enteringWorkspace/connectingMonitor + deploy.* 11键 + server.jsonFormatPlaceholder + system.* 3键 + audit.* 2键 + monitor.* 3键 + aiops.aiAnalysisFailedToast + pipeline.subtitle)
copy-button.tsx 从 import i18n → useTranslation() hook
3 组件新增 useTranslation hook (TerminalLoadingOverlay/WorkspaceTermDialog/LiveMonitorDialog/PredictiveCapacityTab)

zh/en 7616→7640 +24 对齐, tsc -b=0, npm build✓ (17.25s), ESLint=0/43/0, go build=0, 17/17 测试通过
This commit is contained in:
attacker committed 2026-07-13 04:20:10 +08:00
1 parent 8d64936caf
commit 09b7fd4ad5
22 files changed
+114 -55

No files matched your search

@@ -288,7 +288,7 @@ export function LdapManagementSection(props: LdapManagementSectionProps) {
</div>
<div>
<label className="text-xs dg-text-muted mb-1 block">{t('system.userDisplayName')}</label>
<Input value={newUser.display_name} onChange={(e) => setNewUser({ ...newUser, display_name: e.target.value })} placeholder="张三" className="dg-input" />
<Input value={newUser.display_name} onChange={(e) => setNewUser({ ...newUser, display_name: e.target.value })} placeholder={t('system.namePlaceholder')} className="dg-input" />
</div>
<div>
<label className="text-xs dg-text-muted mb-1 block">{t('system.userEmail')}</label>
@@ -450,7 +450,7 @@ export function LdapManagementSection(props: LdapManagementSectionProps) {
</div>
<div>
<label className="text-xs dg-text-muted mb-1 block">{t('system.jobTitle')}</label>
<Input value={editLdapForm.title} onChange={(e) => setEditLdapForm({ ...editLdapForm, title: e.target.value })} placeholder="运维工程师" className="dg-input" />
<Input value={editLdapForm.title} onChange={(e) => setEditLdapForm({ ...editLdapForm, title: e.target.value })} placeholder={t('system.roleTitlePlaceholder')} className="dg-input" />
</div>
</div>
)}
@@ -1,5 +1,6 @@
// 终端审计实时监控 Dialog — 与 WebSSH 终端弹框一致的布局与适配 // Logan.Li
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Terminal as XTerm } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import 'xterm/css/xterm.css';
@@ -33,6 +34,7 @@ interface LiveMonitorProps {
}
export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }: LiveMonitorProps) {
const { t } = useTranslation();
const containerRef = useRef<HTMLDivElement>(null);
const termRef = useRef<XTerm | null>(null);
const fitRef = useRef<FitAddon | null>(null);
@@ -250,7 +252,7 @@ export function LiveMonitorDialog({ open, onOpenChange, sessionId, sessionInfo }
<div className="relative bg-[#0a0e14]" style={{ height: fullscreen ? 'calc(100vh - 49px)' : '520px' }}>
<div ref={containerRef} className="xterm-terminal-host h-full" />
<TerminalLoadingOverlay show={!connected && !connectError} label="正在连接监控..." />
<TerminalLoadingOverlay show={!connected && !connectError} label={t('common.connectingMonitor')} />
</div>
</DialogContent>
</Dialog>
@@ -237,7 +237,7 @@ export function SystemManager() {
const res = (await userApi.batchDelete(selectedUserIds)) as {
message?: string;
};
toast.success(res?.message || `已删除 ${selectedUserIds.length} 个用户`);
toast.success(res?.message || t('system.batchDeleteUsers', { count: selectedUserIds.length }));
setSelectedUserIds([]);
await loadUsers();
} catch (error: unknown) {