Skip to content

Commit 0a64cdc

Browse files
committed
feat: use full region name
1 parent 9d0654a commit 0a64cdc

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

bun.lockb

741 Bytes
Binary file not shown.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"@radix-ui/react-separator": "^1.1.1",
2525
"@radix-ui/react-slot": "^1.1.1",
2626
"@radix-ui/react-switch": "^1.1.2",
27-
"@tanstack/react-query": "^5.62.14",
28-
"@tanstack/react-query-devtools": "^5.62.14",
27+
"@tanstack/react-query": "^5.62.15",
28+
"@tanstack/react-query-devtools": "^5.62.15",
2929
"@tanstack/react-table": "^8.20.6",
3030
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
3131
"@types/d3-geo": "^3.1.0",
@@ -36,6 +36,7 @@
3636
"d3-geo": "^3.1.1",
3737
"dayjs": "^1.11.13",
3838
"framer-motion": "^12.0.0-alpha.2",
39+
"i18n-iso-countries": "^7.13.0",
3940
"i18next": "^24.2.0",
4041
"lucide-react": "^0.460.0",
4142
"luxon": "^3.5.0",

src/components/ServerDetailOverview.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { useWebSocketContext } from "@/hooks/use-websocket-context"
77
import { formatBytes } from "@/lib/format"
88
import { cn, formatNezhaInfo } from "@/lib/utils"
99
import { NezhaWebsocketResponse } from "@/types/nezha-api"
10+
import countries from "i18n-iso-countries"
11+
import enLocale from "i18n-iso-countries/langs/en.json"
1012
import { useEffect, useState } from "react"
1113
import { useTranslation } from "react-i18next"
1214
import { useNavigate } from "react-router-dom"
@@ -77,6 +79,8 @@ export default function ServerDetailOverview({ server_id }: { server_id: string
7779
// @ts-expect-error CustomBackgroundImage is a global variable
7880
(window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
7981

82+
countries.registerLocale(enLocale)
83+
8084
return (
8185
<div
8286
className={cn({
@@ -168,7 +172,7 @@ export default function ServerDetailOverview({ server_id }: { server_id: string
168172
<section className="flex flex-col items-start gap-0.5">
169173
<p className="text-xs text-muted-foreground">{t("serverDetail.region")}</p>
170174
<section className="flex items-start gap-1">
171-
<div className="text-xs text-start">{country_code?.toUpperCase()}</div>
175+
<div className="text-xs text-start">{countries.getName(country_code?.toUpperCase(), "en")}</div>
172176
{country_code && <ServerFlag className="text-[11px] -mt-[1px]" country_code={country_code} />}
173177
</section>
174178
</section>

0 commit comments

Comments
 (0)