mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-25 09:41:49 +08:00
feat: add turkish automatic recognition (#486)
* feat: add turkish automatic recognition * Update src/store/index.js
This commit is contained in:
parent
750e1997e6
commit
bf61fe6e28
|
@ -27,9 +27,12 @@ const store = new Vuex.Store(options);
|
|||
|
||||
if ([undefined, null].includes(store.state.settings.lang)) {
|
||||
const defaultLang = "en";
|
||||
// when more languages are available, use Map instead of prefer logic
|
||||
const preferChinese = navigator.language.slice(0, 2) === "zh";
|
||||
store.state.settings.lang = preferChinese ? "zh-CN" : defaultLang;
|
||||
const langMapper = new Map()
|
||||
.set("zh", "zh-CN")
|
||||
.set("en", "en")
|
||||
.set("tr", "tr");
|
||||
store.state.settings.lang =
|
||||
langMapper.get(navigator.language.slice(0, 2)) || defaultLang;
|
||||
localStorage.setItem("settings", JSON.stringify(store.state.settings));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user