ChatGPT Logo

This commit is contained in:
Hao Jia
2024-05-16 15:03:14 +08:00
parent 01c9dbc1fd
commit bfdb47a7ed
8 changed files with 608 additions and 673 deletions

View File

@@ -8,7 +8,7 @@ const cn = {
Error: {
Unauthorized: isApp
? "检测到无效 API Key请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
: "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
: "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码。",
},
Auth: {
Title: "需要密码",

View File

@@ -71,9 +71,9 @@ export const ALL_LANG_OPTIONS: Record<Lang, string> = {
};
const LANG_KEY = "lang";
const DEFAULT_LANG = "en";
const DEFAULT_LANG = "cn";
const fallbackLang = en;
const fallbackLang = cn;
const targetLang = ALL_LANGS[getLang()] as LocaleType;
// if target lang missing some fields, it will use fallback lang string
@@ -104,19 +104,19 @@ function getLanguage() {
}
export function getLang(): Lang {
const savedLang = getItem(LANG_KEY);
if (AllLangs.includes((savedLang ?? "") as Lang)) {
return savedLang as Lang;
}
const lang = getLanguage();
for (const option of AllLangs) {
if (lang.includes(option)) {
return option;
}
}
// const savedLang = getItem(LANG_KEY);
//
// if (AllLangs.includes((savedLang ?? "") as Lang)) {
// return savedLang as Lang;
// }
//
// const lang = getLanguage();
//
// for (const option of AllLangs) {
// if (lang.includes(option)) {
// return option;
// }
// }
return DEFAULT_LANG;
}