refactor(i18n): U24 Monitor 模块 i18n hook 迁移 — 26 个 .tsx 文件从全局 i18n.t() 迁移到 useTranslation() hook + 89 个 phantom 中文文本键替换为 monitor.lbl.* 语义化键
- 新增 monitor.lbl 翻译子命名空间 89 键(HostMonitor/Middleware/Site/SNMP/Shared)
- 26 .tsx: import i18n → useTranslation() hook + i18n.t('中文') → t('monitor.lbl.semanticKey')
- 模块级代码(TABS/METRIC_CATEGORIES)保留 i18n.t() + 语义化键
- 1 .ts helpers 文件 phantom 键替换
- zh/en 6886→6975 +89 键对齐
- tsc -b=0, npm build✓ (17.16s), ESLint=0/53/0, go build=0, Docker healthy
This commit is contained in:
1 parent
de6f9454fc
commit
d21eac9117
29 files changed
+520
-284
No files matched your search
@@ -13,7 +13,7 @@ import {
|
||||
import { ChartToolbar } from './ChartToolbar';
|
||||
import { MonitorChartTooltip } from '../shared/monitorChartTheme';
|
||||
import { ChartRangeHint } from '../shared/ChartRangeHint';
|
||||
import i18n from '@/i18n';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export interface ChartSeries {
|
||||
dataKey: string;
|
||||
@@ -192,6 +192,7 @@ export const ZoomableAreaChart = forwardRef<ZoomableChartHandle, Props>(function
|
||||
onZoomedChange,
|
||||
referenceLines,
|
||||
}, ref) {
|
||||
const { t } = useTranslation();
|
||||
const uid = useId().replace(/:/g, '');
|
||||
const gradPrefix = `grad-${chartId}-${uid}`;
|
||||
|
||||
@@ -316,11 +317,11 @@ export const ZoomableAreaChart = forwardRef<ZoomableChartHandle, Props>(function
|
||||
<DialogContent className={dialogClass}>
|
||||
<DialogHeader className="shrink-0 flex-row items-start justify-between gap-4 space-y-0 pr-10">
|
||||
<div className="min-w-0">
|
||||
<DialogTitle className="text-base truncate">{title || i18n.t('指标详情')}</DialogTitle>
|
||||
<DialogTitle className="text-base truncate">{title || t('monitor.lbl.metricDetail')}</DialogTitle>
|
||||
{subtitle && (
|
||||
<p className="text-xs dg-text-muted mt-0.5 truncate">{subtitle}</p>
|
||||
)}
|
||||
<DialogDescription className="sr-only"> {i18n.t('选择主机...')} </DialogDescription>
|
||||
<DialogDescription className="sr-only"> {t('monitor.lbl.selectHost')} </DialogDescription>
|
||||
</div>
|
||||
<ChartToolbar
|
||||
size="md"
|
||||
|
||||
Reference in new issue
Block a user