当设备未连接时,各页面默认显示英文语言的文本,并在标题追加 (Disconnect)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import localeEn from "./data-en.json";
|
||||
import localeZh from "./data-zh.json";
|
||||
import localeZhHK from "./data-zh-HK.json";
|
||||
|
||||
/** Device language index: 0=en, 1=zh-HK, 2=zh-CN */
|
||||
export const DEFAULT_DEVICE_LANGUAGE = 0;
|
||||
|
||||
export type LocalePack = typeof localeEn;
|
||||
|
||||
export function resolveDeviceLanguage(language: number | undefined): number {
|
||||
return language ?? DEFAULT_DEVICE_LANGUAGE;
|
||||
}
|
||||
|
||||
export function resolveLocalePack(language: number | undefined): LocalePack {
|
||||
const lang = resolveDeviceLanguage(language);
|
||||
if (lang === 0) return localeEn;
|
||||
if (lang === 1) return localeZhHK;
|
||||
return localeZh;
|
||||
}
|
||||
Reference in New Issue
Block a user