mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-18 06:07:48 +00:00
chore: Feature/prettier eslint (#397)
* feat: add translations * refactor: use trinocular operators instead if * style: add prettier to eslint, fix lint errors * chore: add .gitattr
This commit is contained in:
parent
a25c874b7d
commit
52d7a2af26
10 changed files with 59 additions and 14 deletions
|
|
@ -26,9 +26,10 @@ const options = {
|
|||
const store = new Vuex.Store(options);
|
||||
|
||||
if ([undefined, null].includes(store.state.settings.lang)) {
|
||||
let lang = "en";
|
||||
if (navigator.language.slice(0, 2) === "zh") lang = "zh-CN";
|
||||
store.state.settings.lang = 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;
|
||||
localStorage.setItem("settings", JSON.stringify(store.state.settings));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue