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:
attacker committed 2026-07-11 20:15:44 +08:00
1 parent de6f9454fc
commit d21eac9117
29 files changed
+520 -284

No files matched your search

@@ -9,7 +9,7 @@ import {
type TimeRangePresetId,
} from './types';
import { presetToRange, toDatetimeLocalValue, formatRangeSummary } from './timeRange';
import i18n from '@/i18n';
import { useTranslation } from 'react-i18next';
interface Props {
value: HostMonitorTimeRange;
@@ -17,6 +17,7 @@ interface Props {
}
export function HostTimeRangePicker({ value, onChange }: Props) {
const { t } = useTranslation();
const [customOpen, setCustomOpen] = useState(false);
const now = new Date();
const [customStart, setCustomStart] = useState(toDatetimeLocalValue(new Date(now.getTime() - 3600_000)));
@@ -45,7 +46,7 @@ export function HostTimeRangePicker({ value, onChange }: Props) {
const e = start.getTime() <= end.getTime() ? end : start;
onChange({
preset: 'custom',
label: i18n.t('aiops.providerCustom'),
label: t('aiops.providerCustom'),
start: s.toISOString(),
end: e.toISOString(),
buckets: Math.min(120, Math.max(36, Math.ceil((e.getTime() - s.getTime()) / 60_000 / 2))),
@@ -86,10 +87,10 @@ export function HostTimeRangePicker({ value, onChange }: Props) {
</Button>
{customOpen && (
<div className="absolute right-0 top-full mt-1 z-50 w-72 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-primary)] p-3 shadow-lg">
<p className="text-xs font-medium text-[var(--dg-text-primary)] mb-2"> {i18n.t('无限制')} </p>
<p className="text-xs font-medium text-[var(--dg-text-primary)] mb-2"> {t('monitor.lbl.unlimited')} </p>
<div className="space-y-2">
<div>
<label className="text-[10px] dg-text-muted"> {i18n.t('common.start')} </label>
<label className="text-[10px] dg-text-muted"> {t('common.start')} </label>
<Input
type="datetime-local"
value={customStart}
@@ -98,7 +99,7 @@ export function HostTimeRangePicker({ value, onChange }: Props) {
/>
</div>
<div>
<label className="text-[10px] dg-text-muted"> {i18n.t('无限制')} </label>
<label className="text-[10px] dg-text-muted"> {t('monitor.lbl.unlimited')} </label>
<Input
type="datetime-local"
value={customEnd}