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

@@ -2,6 +2,7 @@ import { Component, type ErrorInfo, type ReactNode } from 'react';
import { Button } from '@/components/ui/button';
import { AlertTriangle, RotateCcw, Home, Bug } from 'lucide-react';
import { toast } from 'sonner';
import { useTranslation } from 'react-i18next';
import i18n from '@/i18n';
interface Props {
@@ -32,8 +33,8 @@ export class ErrorBoundary extends Component<Props, State> {
}
override componentDidCatch(error: Error, errorInfo: ErrorInfo) {
console.error(i18n.t('ui.errorboundary.sc0bdc3'), error);
console.error(i18n.t('ui.errorboundary.s1f72f8'), errorInfo.componentStack);
console.error(i18n.t('common.ebCaughtError'), error);
console.error(i18n.t('common.ebErrorInfo'), errorInfo.componentStack);
this.setState({ error, errorInfo });
}
@@ -47,11 +48,11 @@ export class ErrorBoundary extends Component<Props, State> {
handleReport = () => {
const { error, errorInfo } = this.state;
const body = i18n.t('ui.errorboundary.s8f0ca2', { new Date().toISOString(): new Date().toISOString(), window.location.href: window.location.href, navigator.userAgent: navigator.userAgent, error?.name: error?.name, error?.message: error?.message, errorInfo?.componentStack: errorInfo?.componentStack });
const body = `## 错误报告\n\n**时间:** ${new Date().toISOString()}\n**URL:** ${window.location.href}\n**用户代理:** ${navigator.userAgent}\n\n### 错误信息\n\n\`\`\`\n${error?.name}: ${error?.message}\n\`\`\`\n\n### 组件堆栈\n\n\`\`\`\n${errorInfo?.componentStack}\n\`\`\`\n`;
navigator.clipboard.writeText(body).then(() => {
toast.success(i18n.t('ui.errorboundary.sf29c9d'));
toast.success(i18n.t('common.errorCopiedToClipboard'));
}).catch(() => {
toast.error(i18n.t('ui.errorboundary.s7b5065'));
toast.error(i18n.t('common.copyFailedManual'));
});
};
@@ -116,7 +117,7 @@ export class ErrorBoundary extends Component<Props, State> {
onClick={this.handleRetry}
>
<RotateCcw className="h-4 w-4 mr-1.5" />
重新加载
{i18n.t('common.reload')}
</Button>
<Button
variant="outline"