From 91a2f17b1da70db6534dde16c752dfaa1c9ce99b Mon Sep 17 00:00:00 2001 From: kazeyukiro Date: Thu, 1 Oct 2026 04:27:17 +0000 Subject: [PATCH] i18n: localize dashboard metric labels across 18 locales Replace hardcoded Peak/Avg/Free/open sockets/Mihomo/CPU strings with dashboard.* keys and fill translations for all panel languages. --- frontend/src/i18n/locales/ar.ts | 7 ++++++- frontend/src/i18n/locales/de.ts | 7 ++++++- frontend/src/i18n/locales/en.ts | 7 ++++++- frontend/src/i18n/locales/es.ts | 7 ++++++- frontend/src/i18n/locales/fr.ts | 7 ++++++- frontend/src/i18n/locales/hi.ts | 7 ++++++- frontend/src/i18n/locales/id.ts | 7 ++++++- frontend/src/i18n/locales/ja.ts | 7 ++++++- frontend/src/i18n/locales/ko.ts | 7 ++++++- frontend/src/i18n/locales/pl.ts | 7 ++++++- frontend/src/i18n/locales/pt-BR.ts | 7 ++++++- frontend/src/i18n/locales/ru.ts | 7 ++++++- frontend/src/i18n/locales/th.ts | 7 ++++++- frontend/src/i18n/locales/tr.ts | 7 ++++++- frontend/src/i18n/locales/uk.ts | 7 ++++++- frontend/src/i18n/locales/vi.ts | 7 ++++++- frontend/src/i18n/locales/zh-CN.ts | 7 ++++++- frontend/src/i18n/locales/zh-TW.ts | 7 ++++++- frontend/src/pages/Dashboard.tsx | 18 +++++++++--------- 19 files changed, 117 insertions(+), 27 deletions(-) diff --git a/frontend/src/i18n/locales/ar.ts b/frontend/src/i18n/locales/ar.ts index 790ff6f..07108dc 100644 --- a/frontend/src/i18n/locales/ar.ts +++ b/frontend/src/i18n/locales/ar.ts @@ -154,7 +154,12 @@ export default { "unavailable": "الحالة غير متاحة", "users": "المستخدمون", "totalUsers": "إجمالي المستخدمين", - "enabledUsers": "المستخدمون النشطون" + "enabledUsers": "المستخدمون النشطون", + "peak": "الذروة", + "avg": "المتوسط", + "free": "متاح", + "openSockets": "مقابس مفتوحة", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/de.ts b/frontend/src/i18n/locales/de.ts index d7c1ec4..52dbb01 100644 --- a/frontend/src/i18n/locales/de.ts +++ b/frontend/src/i18n/locales/de.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Status nicht verfügbar", "users": "Benutzer", "totalUsers": "Benutzer gesamt", - "enabledUsers": "Aktive Benutzer" + "enabledUsers": "Aktive Benutzer", + "peak": "Spitze", + "avg": "Mittel", + "free": "Frei", + "openSockets": "Offene Sockets", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index fb6e612..62a8469 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -156,7 +156,12 @@ export default { "unavailable": "Status unavailable", "users": "Users", "totalUsers": "Total users", - "enabledUsers": "Enabled users" + "enabledUsers": "Enabled users", + "peak": "Peak", + "avg": "Avg", + "free": "Free", + "openSockets": "Open sockets", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/es.ts b/frontend/src/i18n/locales/es.ts index 158fb66..59330e9 100644 --- a/frontend/src/i18n/locales/es.ts +++ b/frontend/src/i18n/locales/es.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Estado no disponible", "users": "Usuarios", "totalUsers": "Usuarios totales", - "enabledUsers": "Usuarios activos" + "enabledUsers": "Usuarios activos", + "peak": "Pico", + "avg": "Prom.", + "free": "Libre", + "openSockets": "Sockets abiertos", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/fr.ts b/frontend/src/i18n/locales/fr.ts index 8320404..e4a39e7 100644 --- a/frontend/src/i18n/locales/fr.ts +++ b/frontend/src/i18n/locales/fr.ts @@ -154,7 +154,12 @@ export default { "unavailable": "État indisponible", "users": "Utilisateurs", "totalUsers": "Utilisateurs total", - "enabledUsers": "Utilisateurs actifs" + "enabledUsers": "Utilisateurs actifs", + "peak": "Pic", + "avg": "Moy.", + "free": "Libre", + "openSockets": "Sockets ouverts", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/hi.ts b/frontend/src/i18n/locales/hi.ts index 2d0dcde..304948a 100644 --- a/frontend/src/i18n/locales/hi.ts +++ b/frontend/src/i18n/locales/hi.ts @@ -154,7 +154,12 @@ export default { "unavailable": "स्थिति उपलब्ध नहीं", "users": "उपयोगकर्ता", "totalUsers": "कुल उपयोगकर्ता", - "enabledUsers": "सक्रिय उपयोगकर्ता" + "enabledUsers": "सक्रिय उपयोगकर्ता", + "peak": "शिखर", + "avg": "औसत", + "free": "खाली", + "openSockets": "खुले सॉकेट", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/id.ts b/frontend/src/i18n/locales/id.ts index 0430355..77725f1 100644 --- a/frontend/src/i18n/locales/id.ts +++ b/frontend/src/i18n/locales/id.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Status tidak tersedia", "users": "Pengguna", "totalUsers": "Total pengguna", - "enabledUsers": "Pengguna aktif" + "enabledUsers": "Pengguna aktif", + "peak": "Puncak", + "avg": "Rata-rata", + "free": "Tersedia", + "openSockets": "Socket terbuka", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/ja.ts b/frontend/src/i18n/locales/ja.ts index 0b1d9c3..2b02d60 100644 --- a/frontend/src/i18n/locales/ja.ts +++ b/frontend/src/i18n/locales/ja.ts @@ -154,7 +154,12 @@ export default { "unavailable": "状態取得不可", "users": "ユーザー", "totalUsers": "ユーザー合計", - "enabledUsers": "有効ユーザー" + "enabledUsers": "有効ユーザー", + "peak": "ピーク", + "avg": "平均", + "free": "空き", + "openSockets": "オープン接続", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/ko.ts b/frontend/src/i18n/locales/ko.ts index 9be17e4..ae9fd60 100644 --- a/frontend/src/i18n/locales/ko.ts +++ b/frontend/src/i18n/locales/ko.ts @@ -154,7 +154,12 @@ export default { "unavailable": "상태 없음", "users": "사용자", "totalUsers": "총 사용자", - "enabledUsers": "활성 사용자" + "enabledUsers": "활성 사용자", + "peak": "최대", + "avg": "평균", + "free": "여유", + "openSockets": "열린 소켓", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/pl.ts b/frontend/src/i18n/locales/pl.ts index 4eeb5a7..86c53b6 100644 --- a/frontend/src/i18n/locales/pl.ts +++ b/frontend/src/i18n/locales/pl.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Status niedostępny", "users": "Użytkownicy", "totalUsers": "Łącznie użytkowników", - "enabledUsers": "Aktywni użytkownicy" + "enabledUsers": "Aktywni użytkownicy", + "peak": "Szczyt", + "avg": "Śr.", + "free": "Wolne", + "openSockets": "Otwarte gniazda", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/pt-BR.ts b/frontend/src/i18n/locales/pt-BR.ts index dc636aa..d167eed 100644 --- a/frontend/src/i18n/locales/pt-BR.ts +++ b/frontend/src/i18n/locales/pt-BR.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Status indisponível", "users": "Usuários", "totalUsers": "Total de usuários", - "enabledUsers": "Usuários ativos" + "enabledUsers": "Usuários ativos", + "peak": "Pico", + "avg": "Méd.", + "free": "Livre", + "openSockets": "Sockets abertos", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/ru.ts b/frontend/src/i18n/locales/ru.ts index b98fb68..5da59b6 100644 --- a/frontend/src/i18n/locales/ru.ts +++ b/frontend/src/i18n/locales/ru.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Статус недоступен", "users": "Пользователи", "totalUsers": "Всего пользователей", - "enabledUsers": "Активные пользователи" + "enabledUsers": "Активные пользователи", + "peak": "Пик", + "avg": "Сред.", + "free": "Свободно", + "openSockets": "Открытые сокеты", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/th.ts b/frontend/src/i18n/locales/th.ts index 56c0da5..5b56fbd 100644 --- a/frontend/src/i18n/locales/th.ts +++ b/frontend/src/i18n/locales/th.ts @@ -154,7 +154,12 @@ export default { "unavailable": "ไม่มีสถานะ", "users": "ผู้ใช้", "totalUsers": "ผู้ใช้ทั้งหมด", - "enabledUsers": "ผู้ใช้ที่เปิดใช้" + "enabledUsers": "ผู้ใช้ที่เปิดใช้", + "peak": "สูงสุด", + "avg": "เฉลี่ย", + "free": "ว่าง", + "openSockets": "การเชื่อมต่อที่เปิด", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/tr.ts b/frontend/src/i18n/locales/tr.ts index d8e26a6..9ebf5dd 100644 --- a/frontend/src/i18n/locales/tr.ts +++ b/frontend/src/i18n/locales/tr.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Durum yok", "users": "Kullanıcılar", "totalUsers": "Toplam kullanıcı", - "enabledUsers": "Aktif kullanıcılar" + "enabledUsers": "Aktif kullanıcılar", + "peak": "Zirve", + "avg": "Ort.", + "free": "Boş", + "openSockets": "Açık soketler", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/uk.ts b/frontend/src/i18n/locales/uk.ts index 343a75f..02c446f 100644 --- a/frontend/src/i18n/locales/uk.ts +++ b/frontend/src/i18n/locales/uk.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Статус недоступний", "users": "Користувачі", "totalUsers": "Всього користувачів", - "enabledUsers": "Активні користувачі" + "enabledUsers": "Активні користувачі", + "peak": "Пік", + "avg": "Сер.", + "free": "Вільно", + "openSockets": "Відкриті сокети", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/vi.ts b/frontend/src/i18n/locales/vi.ts index dc7d208..056a777 100644 --- a/frontend/src/i18n/locales/vi.ts +++ b/frontend/src/i18n/locales/vi.ts @@ -154,7 +154,12 @@ export default { "unavailable": "Không có trạng thái", "users": "Người dùng", "totalUsers": "Tổng người dùng", - "enabledUsers": "Người dùng đã bật" + "enabledUsers": "Người dùng đã bật", + "peak": "Đỉnh", + "avg": "TB", + "free": "Còn trống", + "openSockets": "Kết nối đang mở", + "coreName": "Mihomo" }, "listeners": { "subtitle": "Create and manage Mihomo inbound listeners.", diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 8613f70..885a6f1 100644 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -156,7 +156,12 @@ export default { "unavailable": "无法获取状态", "users": "用户", "totalUsers": "用户总数", - "enabledUsers": "启用用户" + "enabledUsers": "启用用户", + "peak": "峰值", + "avg": "平均", + "free": "可用", + "openSockets": "打开连接", + "coreName": "Mihomo" }, "listeners": { "subtitle": "创建与管理 Mihomo 入站节点。", diff --git a/frontend/src/i18n/locales/zh-TW.ts b/frontend/src/i18n/locales/zh-TW.ts index 2a140ab..7fe5656 100644 --- a/frontend/src/i18n/locales/zh-TW.ts +++ b/frontend/src/i18n/locales/zh-TW.ts @@ -154,7 +154,12 @@ export default { "unavailable": "無法获取狀態", "users": "使用者", "totalUsers": "使用者總数", - "enabledUsers": "啟用使用者" + "enabledUsers": "啟用使用者", + "peak": "峰值", + "avg": "平均", + "free": "可用", + "openSockets": "開啟連線", + "coreName": "Mihomo" }, "listeners": { "subtitle": "建立与管理 Mihomo 入站節點。", diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 0738ebd..1363e27 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -305,7 +305,7 @@ const Dashboard: React.FC = () => { }} /> - Mihomo · {coreRunning ? t('dashboard.running') : t('dashboard.stoppedStatus')} + {t('dashboard.coreName')} · {coreRunning ? t('dashboard.running') : t('dashboard.stoppedStatus')} {data?.mihomo?.version ? ( {data.mihomo.version} @@ -346,7 +346,7 @@ const Dashboard: React.FC = () => { value={String(cpuPct)} unit="%" detail={undefined} - peak={hist.cpu.length ? `PEAK ${Math.max(...hist.cpu)}%` : undefined} + peak={hist.cpu.length ? `${t('dashboard.peak')} ${Math.max(...hist.cpu)}%` : undefined} series={hist.cpu} color={cpuPct >= 80 ? token.colorError : accent} isMobile={isMobile} @@ -358,7 +358,7 @@ const Dashboard: React.FC = () => { value={String(memPct)} unit="%" detail={`${formatBytes(sys?.memory?.used || 0)} / ${formatBytes(sys?.memory?.total || 0)}`} - peak={hist.mem.length ? `AVG ${Math.round((hist.mem.reduce((a, b) => a + b, 0) / hist.mem.length) * 10) / 10}%` : undefined} + peak={hist.mem.length ? `${t('dashboard.avg')} ${Math.round((hist.mem.reduce((a, b) => a + b, 0) / hist.mem.length) * 10) / 10}%` : undefined} series={hist.mem} color={memPct >= 80 ? token.colorError : accent} isMobile={isMobile} @@ -370,7 +370,7 @@ const Dashboard: React.FC = () => { value={String(diskPct)} unit="%" detail={`${formatBytes(sys?.disk?.used || 0)} / ${formatBytes(sys?.disk?.total || 0)}`} - peak={sys?.disk?.total ? `FREE ${formatBytes(Math.max(0, (sys?.disk?.total || 0) - (sys?.disk?.used || 0)))}` : undefined} + peak={sys?.disk?.total ? `${t('dashboard.free')} ${formatBytes(Math.max(0, (sys?.disk?.total || 0) - (sys?.disk?.used || 0)))}` : undefined} series={hist.disk} color={diskPct >= 90 ? token.colorError : accent} isMobile={isMobile} @@ -404,7 +404,7 @@ const Dashboard: React.FC = () => { {t('dashboard.traffic')}
- {t('dashboard.uploadRate')} peak {formatRate(peakUp)} · {t('dashboard.downloadRate')} peak{' '} + {t('dashboard.uploadRate')} · {t('dashboard.peak')} {formatRate(peakUp)} · {t('dashboard.downloadRate')} · {t('dashboard.peak')}{' '} {formatRate(peakDown)}
@@ -474,7 +474,7 @@ const Dashboard: React.FC = () => { {conns} - open sockets + {t('dashboard.openSockets')}
@@ -517,7 +517,7 @@ const Dashboard: React.FC = () => {
{data?.mihomo?.uptime || '—'}
- Mihomo + {t('dashboard.coreName')} @@ -528,7 +528,7 @@ const Dashboard: React.FC = () => { {panel?.memory_used != null ? formatBytes(panel.memory_used) : '—'} {panel?.cpu_percent != null ? ( - CPU {clampPct(panel.cpu_percent)}% + {t('dashboard.cpu')} {clampPct(panel.cpu_percent)}% ) : null}
@@ -544,7 +544,7 @@ const Dashboard: React.FC = () => { {coreRunning && core?.memory_used != null ? formatBytes(core.memory_used) : '—'} {coreRunning && core?.cpu_percent != null ? ( - CPU {clampPct(core.cpu_percent)}% + {t('dashboard.cpu')} {clampPct(core.cpu_percent)}% ) : null}