Browse Source

fix: #1210 change default lang to en

Yidadaa 1 year ago
parent
commit
328ecd1cfb
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/locales/index.ts

+ 4 - 2
app/locales/index.ts

@@ -22,6 +22,7 @@ export const AllLangs = [
 export type Lang = (typeof AllLangs)[number];
 
 const LANG_KEY = "lang";
+const DEFAULT_LANG = "en";
 
 function getItem(key: string) {
   try {
@@ -41,7 +42,8 @@ function getLanguage() {
   try {
     return navigator.language.toLowerCase();
   } catch {
-    return "cn";
+    console.log("[Lang] failed to detect user lang.");
+    return DEFAULT_LANG;
   }
 }
 
@@ -60,7 +62,7 @@ export function getLang(): Lang {
     }
   }
 
-  return "en";
+  return DEFAULT_LANG;
 }
 
 export function changeLang(lang: Lang) {