Update locale files for English, Traditional Chinese, and Simplified Chinese to include page titles for I/O section; refactor IOPage to dynamically display the localized title based on device language state.
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"label": "Input/Output",
|
"label": "Input/Output",
|
||||||
|
"pageTitle": "I/O",
|
||||||
"input": {
|
"input": {
|
||||||
"coaxial": "COAXIAL",
|
"coaxial": "COAXIAL",
|
||||||
"optical": "OPTICAL",
|
"optical": "OPTICAL",
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"label": "輸入/輸出",
|
"label": "輸入/輸出",
|
||||||
|
"pageTitle": "輸入/輸出",
|
||||||
"input": { "coaxial": "同軸", "optical": "光纖", "bluetooth": "藍牙", "rca": "類比RCA" },
|
"input": { "coaxial": "同軸", "optical": "光纖", "bluetooth": "藍牙", "rca": "類比RCA" },
|
||||||
"output": { "headset": "耳機" }
|
"output": { "headset": "耳機" }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"label": "输入输出",
|
"label": "输入输出",
|
||||||
|
"pageTitle": "输入输出",
|
||||||
"input": { "coaxial": "同轴", "optical": "光钎", "bluetooth": "蓝牙", "rca": "模拟RCA" },
|
"input": { "coaxial": "同轴", "optical": "光钎", "bluetooth": "蓝牙", "rca": "模拟RCA" },
|
||||||
"output": { "headset": "耳机" }
|
"output": { "headset": "耳机" }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import { cn } from "@/lib/utils";
|
|||||||
import BottomNav from "@/components/BottomNav";
|
import BottomNav from "@/components/BottomNav";
|
||||||
import { ChevronLeft } from "lucide-react";
|
import { ChevronLeft } from "lucide-react";
|
||||||
import { useLocation } from "wouter";
|
import { useLocation } from "wouter";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import localeZh from "@/locales/data-zh.json";
|
||||||
|
import localeZhHK from "@/locales/data-zh-HK.json";
|
||||||
|
import localeEn from "@/locales/data-en.json";
|
||||||
|
|
||||||
interface IOOption {
|
interface IOOption {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -101,6 +105,12 @@ export default function IOPage() {
|
|||||||
const [, setLocation] = useLocation();
|
const [, setLocation] = useLocation();
|
||||||
const { deviceState, setInput, setOutput } = useDevice();
|
const { deviceState, setInput, setOutput } = useDevice();
|
||||||
|
|
||||||
|
const ioPageTitle = useMemo(() => {
|
||||||
|
const lang = deviceState?.language;
|
||||||
|
const pack = lang === 0 ? localeEn : lang === 1 ? localeZhHK : localeZh;
|
||||||
|
return pack.source?.pageTitle ?? pack.source?.label ?? "输入输出";
|
||||||
|
}, [deviceState?.language]);
|
||||||
|
|
||||||
const currentInput = deviceState?.input ?? 1;
|
const currentInput = deviceState?.input ?? 1;
|
||||||
const currentOutput = deviceState?.output ?? 2;
|
const currentOutput = deviceState?.output ?? 2;
|
||||||
|
|
||||||
@@ -110,7 +120,7 @@ export default function IOPage() {
|
|||||||
<button onClick={() => setLocation("/")} className="mr-4 text-white/60 active:text-white transition-colors">
|
<button onClick={() => setLocation("/")} className="mr-4 text-white/60 active:text-white transition-colors">
|
||||||
<ChevronLeft size={24} />
|
<ChevronLeft size={24} />
|
||||||
</button>
|
</button>
|
||||||
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">输入输出</h1>
|
<h1 className="flex-1 text-center text-[17px] font-semibold text-white">{ioPageTitle}</h1>
|
||||||
<div className="w-8" />
|
<div className="w-8" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user