当设备未连接时,各页面默认显示英文语言的文本,并在标题追加 (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
+5 -20
View File
@@ -53,10 +53,9 @@ import {
} from "@/components/ui/alert-dialog";
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 { usePageTitleWithConnection } from "@/hooks/usePageTitleWithConnection";
@@ -92,18 +91,6 @@ type LocaleRoot = {
const LOCALE_BY_LANG: Record<number, LocaleRoot> = {
0: localeEn as LocaleRoot,
1: localeZhHK as LocaleRoot,
2: localeZh as LocaleRoot,
};
/* ── Key → API field mapping ── */
const KEY_TO_SETTING: Record<string, string> = {
@@ -232,11 +219,9 @@ export default function SelectPage() {
const [passthroughConfirmIdx, setPassthroughConfirmIdx] = useState<number | null>(null);
const pageTitle = usePageTitleWithConnection(state?.title ?? "");
const langIdx = deviceState?.language ?? 2;
const dacVolumeDirectText = (LOCALE_BY_LANG[langIdx] ?? localeZh as LocaleRoot).dac?.dacVolumeDirect;
const dacVolumeDirectText = resolveLocalePack(deviceState?.language).dac?.dacVolumeDirect;
@@ -390,7 +375,7 @@ export default function SelectPage() {
</button>
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">{title}</h1>
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">{pageTitle}</h1>
<div className="w-8" />