fix(i18n): 回退到稳定的 32% 覆盖率状态 (tsc + Vite 构建通过)

批量转换脚本引入的语法错误已回退,保留稳定的 i18n 转换:
- 翻译词典: 22 namespaces, 3600+ keys
- 已接入: 145+ 文件 (Dashboard/Login/K8s 主页面/Monitor/System/Deploy)
- 语言切换器在 Header 中可用 (🇨🇳/🇺🇸)
- tsc 零错误, Vite 构建成功
This commit is contained in:
attacker committed 2026-07-03 02:02:29 +08:00
1 parent ecec73989b
commit 72bfb0e12d
191 files changed
+5057 -7592

No files matched your search

@@ -15,6 +15,7 @@ import {
import { auditApi } from '@/api';
import type { OperationLog } from '@/types';
import type { JsonData } from '@/types/common';
import { useTranslation } from 'react-i18next';
interface SystemLogsTabProps {
searchQuery: string;
@@ -39,6 +40,7 @@ function normalizeLog(raw: JsonData): OperationLog {
}
export function SystemLogsTab({ searchQuery, setSearchQuery }: SystemLogsTabProps) {
const { t } = useTranslation();
const [logs, setLogs] = useState<OperationLog[]>([]);
const [loading, setLoading] = useState(true);
@@ -69,11 +71,11 @@ export function SystemLogsTab({ searchQuery, setSearchQuery }: SystemLogsTabProp
const getLogResultBadge = (result: OperationLog['result']) => {
return result === 'success' ? (
<Badge variant="outline" className="border-emerald-500/30 dg-text-green bg-emerald-500/10">
成功
{t('system.auditSuccess')}
</Badge>
) : (
<Badge variant="outline" className="border-red-500/30 dg-text-red bg-red-500/10">
失败
{t('system.auditFailed')}
</Badge>
);
};
@@ -85,7 +87,7 @@ export function SystemLogsTab({ searchQuery, setSearchQuery }: SystemLogsTabProp
<div className="relative w-64">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dg-text-muted" />
<Input
placeholder="搜索操作日志..."
placeholder={t('audit.operations.searchPlaceholder')}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="pl-9 h-9 dg-input"
@@ -97,7 +99,7 @@ export function SystemLogsTab({ searchQuery, setSearchQuery }: SystemLogsTabProp
onClick={fetchLogs}
>
<RefreshCw className="h-4 w-4 mr-2" />
刷新
{t('common.refresh')}
</Button>
</div>
@@ -112,19 +114,19 @@ export function SystemLogsTab({ searchQuery, setSearchQuery }: SystemLogsTabProp
) : filteredLogs.length === 0 ? (
<div className="flex flex-col items-center justify-center py-16 dg-text-muted">
<Search className="h-8 w-8 mb-3 opacity-40" />
<p className="text-sm">暂无操作日志</p>
<p className="text-sm">{t('audit.operations.noData')}</p>
</div>
) : (
<Table>
<TableHeader>
<TableRow className="border-[var(--dg-border)] hover:bg-transparent">
<TableHead className="dg-text-secondary">时间</TableHead>
<TableHead className="dg-text-secondary">用户</TableHead>
<TableHead className="dg-text-secondary">模块</TableHead>
<TableHead className="dg-text-secondary">操作</TableHead>
<TableHead className="dg-text-secondary">资源</TableHead>
<TableHead className="dg-text-secondary">IP地址</TableHead>
<TableHead className="dg-text-secondary">结果</TableHead>
<TableHead className="dg-text-secondary">{t('system.auditTime')}</TableHead>
<TableHead className="dg-text-secondary">{t('system.roleUsers')}</TableHead>
<TableHead className="dg-text-secondary">{t('system.auditModule')}</TableHead>
<TableHead className="dg-text-secondary">{t('system.auditAction')}</TableHead>
<TableHead className="dg-text-secondary">{t('system.auditResource')}</TableHead>
<TableHead className="dg-text-secondary">{t('server.csv.ip')}</TableHead>
<TableHead className="dg-text-secondary">{t('system.auditResult')}</TableHead>
</TableRow>
</TableHeader>
<TableBody>