当设备未连接时,各页面默认显示英文语言的文本,并在标题追加 (Disconnect)

This commit is contained in:
eafonyang
2026-07-01 11:23:12 +08:00
parent 1e5e6f5548
commit ac9bac4d18
21 changed files with 113 additions and 460 deletions
+3 -5
View File
@@ -11,8 +11,8 @@ import { cn } from "@/lib/utils";
import { readAndClearAiSplitRestorePath, useAIDrawer } from "@/contexts/AIDrawerContext";
import { useIsLgUp } from "@/hooks/useIsLgUp";
import localeZh from "@/locales/data-zh.json";
import localeZhHK from "@/locales/data-zh-HK.json";
import localeEn from "@/locales/data-en.json";
import { resolveLocalePack } from "@/locales/resolveLocale";
import {
Activity,
Bot,
@@ -49,10 +49,8 @@ export default function BottomNav() {
const { deviceState } = useDevice();
const navText = useMemo((): BottomNavLocale => {
const lang = deviceState?.language;
const pack =
lang === 0 ? localeEn : lang === 1 ? localeZhHK : localeZh;
return (pack.bottomNav ?? localeZh.bottomNav) as BottomNavLocale;
const pack = resolveLocalePack(deviceState?.language);
return (pack.bottomNav ?? localeEn.bottomNav) as BottomNavLocale;
}, [deviceState?.language]);
return (
@@ -14,9 +14,6 @@ function pickConnectLocale(): ConnectLocale {
if (lang === "0") return localeEn.connect;
if (lang === "1") return localeZhHK.connect;
if (lang === "2") return localeZh.connect;
const nav = navigator.language.toLowerCase();
if (nav.startsWith("zh-hk") || nav.startsWith("zh-tw")) return localeZhHK.connect;
if (nav.startsWith("zh")) return localeZh.connect;
return localeEn.connect;
}
-4
View File
@@ -5,10 +5,8 @@
import { useDevice } from "@/contexts/DeviceContext";
import { cn } from "@/lib/utils";
import {
Activity,
Bluetooth,
ChevronRight,
Cpu,
Gauge,
Layers,
LayoutDashboard,
@@ -30,8 +28,6 @@ const NAV_ITEMS: NavItem[] = [
{ path: "/eq", icon: Sliders, label: "Parametric EQ" },
{ path: "/effects", icon: Layers, label: "Effects" },
{ path: "/bluetooth", icon: Bluetooth, label: "Bluetooth" },
{ path: "/dsp", icon: Cpu, label: "DSP & DAC" },
{ path: "/display", icon: Activity, label: "Display & Lights" },
{ path: "/system", icon: Settings, label: "System" },
];