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
@@ -1,12 +1,14 @@
|
||||
import { type ReactNode } from 'react';
|
||||
import { TrendingUp, TrendingDown } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
// 云厂商中文标签(主组件 + 弹窗共享) // Logan.Li
|
||||
export const providerLabels: Record<string, string> = {
|
||||
aliyun: '阿里云',
|
||||
tencent: '腾讯云',
|
||||
aliyun: i18n.t('cloud.aliyun'),
|
||||
tencent: i18n.t('cloud.tencent'),
|
||||
aws: 'AWS',
|
||||
huawei: '华为云',
|
||||
huawei: i18n.t('cloud.huawei'),
|
||||
azure: 'Azure',
|
||||
};
|
||||
|
||||
@@ -29,6 +31,7 @@ export const providerColors: Record<string, string> = {
|
||||
};
|
||||
|
||||
export function ProviderDot({ provider, className = 'w-2 h-2' }: { provider: string; className?: string }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<span
|
||||
className={`rounded-full shrink-0 ${className}`}
|
||||
@@ -49,6 +52,7 @@ export function StatCard({ icon, label, value, trend, trendLabel, alert }: {
|
||||
trendLabel?: string;
|
||||
alert?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className={alert ? 'dg-alert-banner' : 'rounded-lg border border-[var(--border-default)] bg-[var(--surface-raised)]/50 p-4'}>
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
@@ -68,8 +72,9 @@ export function StatCard({ icon, label, value, trend, trendLabel, alert }: {
|
||||
}
|
||||
|
||||
export function TrendChart({ data }: { data: { date: string; cost: number }[] }) {
|
||||
const { t } = useTranslation();
|
||||
if (data.length === 0) {
|
||||
return <p className="text-sm dg-text-muted py-8 text-center">暂无数据</p>;
|
||||
return <p className="text-sm dg-text-muted py-8 text-center">{t('common.noData')}</p>;
|
||||
}
|
||||
const max = Math.max(...data.map((d) => d.cost), 1);
|
||||
const recent = data.slice(-30);
|
||||
|
||||
Reference in new issue
Block a user