From d70bb23e1aa073cfa0549ab51896cc36115401f9 Mon Sep 17 00:00:00 2001 From: Slinetrac Date: Sun, 2 Nov 2025 20:37:27 +0800 Subject: [PATCH] chore(i18n): components.home.ipInfo/traffic.* --- .../home/enhanced-canvas-traffic-graph.tsx | 6 +-- .../home/enhanced-traffic-stats.tsx | 12 ++--- src/components/home/ip-info-card.tsx | 39 +++++++++----- src/locales/ar.json | 51 ++++++++++++------- src/locales/de.json | 51 ++++++++++++------- src/locales/en.json | 51 ++++++++++++------- src/locales/es.json | 51 ++++++++++++------- src/locales/fa.json | 51 ++++++++++++------- src/locales/id.json | 51 ++++++++++++------- src/locales/jp.json | 51 ++++++++++++------- src/locales/ko.json | 51 ++++++++++++------- src/locales/ru.json | 51 ++++++++++++------- src/locales/tr.json | 51 ++++++++++++------- src/locales/tt.json | 51 ++++++++++++------- src/locales/zh.json | 51 ++++++++++++------- src/locales/zhtw.json | 51 ++++++++++++------- 16 files changed, 477 insertions(+), 243 deletions(-) diff --git a/src/components/home/enhanced-canvas-traffic-graph.tsx b/src/components/home/enhanced-canvas-traffic-graph.tsx index 8e59c4d1..87ea1ee0 100644 --- a/src/components/home/enhanced-canvas-traffic-graph.tsx +++ b/src/components/home/enhanced-canvas-traffic-graph.tsx @@ -851,7 +851,7 @@ export const EnhancedCanvasTrafficGraph = memo( // 获取时间范围文本 const getTimeRangeText = useCallback(() => { - return t("{{time}} Minutes", { time: timeRange }); + return t("components.home.traffic.patterns.minutes", { time: timeRange }); }, [timeRange, t]); return ( @@ -934,7 +934,7 @@ export const EnhancedCanvasTrafficGraph = memo( textAlign: "right", }} > - {t("Upload")} + {t("components.home.traffic.legends.upload")} - {t("Download")} + {t("components.home.traffic.legends.download")} diff --git a/src/components/home/enhanced-traffic-stats.tsx b/src/components/home/enhanced-traffic-stats.tsx index 199bbd6f..df26263b 100644 --- a/src/components/home/enhanced-traffic-stats.tsx +++ b/src/components/home/enhanced-traffic-stats.tsx @@ -219,42 +219,42 @@ export const EnhancedTrafficStats = () => { () => [ { icon: , - title: t("Upload Speed"), + title: t("components.home.traffic.metrics.uploadSpeed"), value: parsedData.up, unit: `${parsedData.upUnit}/s`, color: "secondary" as const, }, { icon: , - title: t("Download Speed"), + title: t("components.home.traffic.metrics.downloadSpeed"), value: parsedData.down, unit: `${parsedData.downUnit}/s`, color: "primary" as const, }, { icon: , - title: t("Active Connections"), + title: t("components.home.traffic.metrics.activeConnections"), value: parsedData.connectionsCount, unit: "", color: "success" as const, }, { icon: , - title: t("Uploaded"), + title: t("components.home.traffic.metrics.uploaded"), value: parsedData.uploadTotal, unit: parsedData.uploadTotalUnit, color: "secondary" as const, }, { icon: , - title: t("Downloaded"), + title: t("components.home.traffic.metrics.downloaded"), value: parsedData.downloadTotal, unit: parsedData.downloadTotalUnit, color: "primary" as const, }, { icon: , - title: t("Memory Usage"), + title: t("components.home.traffic.metrics.memoryUsage"), value: parsedData.inuse, unit: parsedData.inuseUnit, color: "error" as const, diff --git a/src/components/home/ip-info-card.tsx b/src/components/home/ip-info-card.tsx index abfe3ac3..46d056db 100644 --- a/src/components/home/ip-info-card.tsx +++ b/src/components/home/ip-info-card.tsx @@ -69,7 +69,11 @@ export const IpInfoCard = () => { setIpInfo(data); setCountdown(IP_REFRESH_SECONDS); } catch (err) { - setError(err instanceof Error ? err.message : t("Failed to get IP info")); + setError( + err instanceof Error + ? err.message + : t("components.home.ipInfo.errors.load"), + ); } finally { setLoading(false); } @@ -114,7 +118,7 @@ export const IpInfoCard = () => { if (loading) { return ( } iconColor="info" action={ @@ -137,7 +141,7 @@ export const IpInfoCard = () => { if (error) { return ( } iconColor="info" action={ @@ -160,7 +164,7 @@ export const IpInfoCard = () => { {error} @@ -170,7 +174,7 @@ export const IpInfoCard = () => { // 渲染正常数据 return ( } iconColor="info" action={ @@ -222,7 +226,7 @@ export const IpInfoCard = () => { maxWidth: "100%", }} > - {ipInfo?.country || t("Unknown")} + {ipInfo?.country || t("components.home.ipInfo.labels.unknown")} @@ -232,7 +236,7 @@ export const IpInfoCard = () => { color="text.secondary" sx={{ flexShrink: 0 }} > - {t("IP")}: + {t("components.home.ipInfo.labels.ip")}: { {/* 右侧:组织、ISP和位置信息 */} - - + + - + @@ -297,7 +310,7 @@ export const IpInfoCard = () => { }} > - {t("Auto refresh")}: {countdown}s + {t("components.home.ipInfo.labels.autoRefresh")}: {countdown}s