Skip to content

Commit

Permalink
According to browser's language to choose default language
Browse files Browse the repository at this point in the history
  • Loading branch information
233dada committed Oct 12, 2024
1 parent c8be2c3 commit cb67faa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/store/modules/userSettings/defaultSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import langData from "@i18n/index.json";
function extractLangs(data: any): string[]{
return Object.values(data).map((locale: any) => locale.Code);
};
const langList = extractLangs(langData);
if(navigator.language === 'zh-CN')
{
var lan = 'zh-si'
}else{
var lan = navigator.language
};
if(langList.includes(lan)){}else{
var lan = 'en'
};
export default Object.freeze(<Settings>{
language: 'zh-si',
language: lan,
disableFilters: false,
compactModulesByArtTypeTable: true,
planetsCalcSp2: false,
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"target": "esnext",
"module": "esnext",
"strict": true,
Expand Down

0 comments on commit cb67faa

Please sign in to comment.