From a491e2ad549e51a9c3082654d09349d2c155432a Mon Sep 17 00:00:00 2001 From: wood chen Date: Sat, 26 Apr 2025 15:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20i18n.js=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=86=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E8=AF=AD=E8=A8=80=E7=BF=BB=E8=AF=91=EF=BC=8C?= =?UTF-8?q?=E7=AE=80=E5=8C=96=E8=B5=84=E6=BA=90=E9=85=8D=E7=BD=AE=E3=80=82?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=9C=A8=20ServerCard=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=E5=A4=A7=E6=95=B0=E5=80=BC=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=95=B0=E5=92=8C=E8=BF=9B=E7=A8=8B=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA=E7=9A=84=E6=B8=85?= =?UTF-8?q?=E6=99=B0=E5=BA=A6=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ServerCard.tsx | 32 ++++++++++++++++++++++---------- src/i18n.js | 16 ---------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/components/ServerCard.tsx b/src/components/ServerCard.tsx index befe57c..7fe0e13 100644 --- a/src/components/ServerCard.tsx +++ b/src/components/ServerCard.tsx @@ -181,6 +181,16 @@ export default function ServerCard({ now, serverInfo, cycleStats }: ServerCardPr return "bg-emerald-500" } + // 格式化大数值,超过1000显示为k格式 + const formatLargeNumber = (num: number) => { + if (num >= 10000) { + return `${Math.floor(num / 1000)}k+` + } else if (num >= 1000) { + return `${(num / 1000).toFixed(1)}k` + } + return num.toString() + } + if (!online) { return ( {/* 连接数与进程数 */} -
-
- - T: {tcp} +
+
+
+ + T: {formatLargeNumber(tcp)}
-
- - U: {udp} +
+ + U: {formatLargeNumber(udp)}
-
- - P: {process} +
+ + P: {formatLargeNumber(process)}
+
diff --git a/src/i18n.js b/src/i18n.js index 75dc158..2a012a4 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,11 +1,7 @@ import i18n from "i18next" import { initReactI18next } from "react-i18next" -import deTranslation from "./locales/de/translation.json" import enTranslation from "./locales/en/translation.json" -import esTranslation from "./locales/es/translation.json" -import ruTranslation from "./locales/ru/translation.json" -import taTranslation from "./locales/ta/translation.json" import zhCNTranslation from "./locales/zh-CN/translation.json" import zhTWTranslation from "./locales/zh-TW/translation.json" @@ -19,18 +15,6 @@ const resources = { "zh-TW": { translation: zhTWTranslation, }, - "de-DE": { - translation: deTranslation, - }, - "es-ES": { - translation: esTranslation, - }, - "ru-RU": { - translation: ruTranslation, - }, - "ta-IN": { - translation: taTranslation, - }, } const getStoredLanguage = () => {