Commit b34435f7 by xcoder

VPN-45 7. Насктройку языка надо сохранять. Я ставлю англ, обновляю страницу - язык снова русс

и вообще язык надо от системы брать
1 parent ba8f2878
......@@ -14,9 +14,31 @@ const langArr = [
];
const key = "KRYSTALVPN";
const LANG = "LANG";
window.onload = function () {
let position = null;
let platform = "desktop";
let langStr = null;
if (mobileCheck() && window.innerWidth <= 1023) {
platform = "mobile";
}
try {
langStr = JSON.parse(localStorage.getItem(LANG));
} catch (error) {
console.log("localStorage is not supported");
}
if (langStr == null) {
const lang = getLangFromBrowser();
switchLang(lang, platform);
}
else {
switchLang(langStr, platform);
}
try {
position = JSON.parse(localStorage.getItem(key));
......@@ -75,6 +97,12 @@ function switchLang(lang, platform) {
const dd = document.querySelector("#langSwitcher");
const ddMobile = document.querySelector("#langSwitcherMobile");
try {
localStorage.setItem(LANG, JSON.stringify(lang));
} catch (error) {
console.log("localStorage is not supported");
}
if (dd != null) {
const title = langArr.filter((elem) => elem.lang === lang)[0].title;
dd.innerHTML = title;
......@@ -325,3 +353,9 @@ function mobileCheck() {
return check || sizeCheck;
}
function getLangFromBrowser() {
const userLang = navigator.language || navigator.userLanguage;
const lang = userLang.split("-")[0];
return lang;
}
\ No newline at end of file
......@@ -903,7 +903,7 @@ hr.delimeter {
display: flex;
flex-direction: column;
align-items: center;
align-items: flex-end;
justify-content: center;
margin-bottom: 14px;
......@@ -911,6 +911,12 @@ hr.delimeter {
user-select: none;
}
@media screen and (max-width: 980px) {
.main > .main-second > .card.descr > .third-description-wrapper {
align-items: center;
}
}
.main
> .main-second
> .card.descr
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!