1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-02 00:38:14 +09:00

Optimize booting script

This commit is contained in:
syuilo 2018-09-10 17:50:34 +09:00
parent f3ab8199a5
commit 4dc8351f56
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -18,6 +18,8 @@
return;
}
const langs = LANGS;
//#region Load settings
let settings = null;
const vuex = localStorage.getItem('vuex');
@ -40,10 +42,10 @@
//#region Detect the user language
let lang = null;
if (LANGS.includes(navigator.language)) {
if (langs.includes(navigator.language)) {
lang = navigator.language;
} else {
lang = LANGS.find(x => x.split('-')[0] == navigator.language);
lang = langs.find(x => x.split('-')[0] == navigator.language);
if (lang == null) {
// Fallback
@ -52,7 +54,7 @@
}
if (settings && settings.device.lang &&
LANGS.includes(settings.device.lang)) {
langs.includes(settings.device.lang)) {
lang = settings.device.lang;
}
//#endregion