feat(i18n): 剩余模块全量国际化 — 51% 覆盖率 (231 文件接入 t())
批量转换 163 个文件,3204 处中文替换为 t() 调用: - Monitor: 日志中心/告警中心/数据源/大屏/站点拨测/SNMP/中间件 全部转换 - Kubernetes: ResourceVisualEditor/NamespaceResourcePage/拓扑/事件 全部转换 - Deploy: 流水线/发布/凭证/RBAC 全部转换 - Server/Cloud/Agent/Task/Layout/UI: 全部转换 - 翻译词典扩展至 6474 行 (22 namespaces, 5000+ keys) - tsc 编译零错误
This commit is contained in:
1 parent
78c27037e3
commit
ecec73989b
166 files changed
+6925
-2800
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 i18n from '@/i18n';
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
@@ -31,8 +32,8 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
}
|
||||
|
||||
override componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||
console.error('[ErrorBoundary] 捕获到错误:', error);
|
||||
console.error('[ErrorBoundary] 错误信息:', errorInfo.componentStack);
|
||||
console.error(i18n.t('ui.errorboundary.sc0bdc3'), error);
|
||||
console.error(i18n.t('ui.errorboundary.s1f72f8'), errorInfo.componentStack);
|
||||
this.setState({ error, errorInfo });
|
||||
}
|
||||
|
||||
@@ -46,11 +47,11 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||
|
||||
handleReport = () => {
|
||||
const { error, errorInfo } = this.state;
|
||||
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`;
|
||||
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 });
|
||||
navigator.clipboard.writeText(body).then(() => {
|
||||
toast.success('错误信息已复制到剪贴板,请粘贴到 Issue 中');
|
||||
toast.success(i18n.t('ui.errorboundary.sf29c9d'));
|
||||
}).catch(() => {
|
||||
toast.error('复制失败,请手动复制错误信息');
|
||||
toast.error(i18n.t('ui.errorboundary.s7b5065'));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user