mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-07-02 04:52:08 +00:00
fix: selecting a supported language
english could be selected by default at first load, even if the user's language was supported by the panel
This commit is contained in:
parent
cad07be847
commit
b0e78a78c0
1 changed files with 19 additions and 0 deletions
|
@ -795,6 +795,25 @@ class LanguageManager {
|
||||||
if (window.navigator) {
|
if (window.navigator) {
|
||||||
lang = window.navigator.language || window.navigator.userLanguage;
|
lang = window.navigator.language || window.navigator.userLanguage;
|
||||||
|
|
||||||
|
const simularLangs = [
|
||||||
|
["ar", this.supportedLanguages[0].value],
|
||||||
|
["fa", this.supportedLanguages[2].value],
|
||||||
|
["ja", this.supportedLanguages[5].value],
|
||||||
|
["ru", this.supportedLanguages[6].value],
|
||||||
|
["vi", this.supportedLanguages[7].value],
|
||||||
|
["es", this.supportedLanguages[8].value],
|
||||||
|
["id", this.supportedLanguages[9].value],
|
||||||
|
["uk", this.supportedLanguages[10].value],
|
||||||
|
["tr", this.supportedLanguages[11].value],
|
||||||
|
["pt", this.supportedLanguages[12].value],
|
||||||
|
]
|
||||||
|
|
||||||
|
simularLangs.forEach((pair) => {
|
||||||
|
if (lang === pair[0]) {
|
||||||
|
lang = pair[1];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (LanguageManager.isSupportLanguage(lang)) {
|
if (LanguageManager.isSupportLanguage(lang)) {
|
||||||
CookieManager.setCookie("lang", lang, 150);
|
CookieManager.setCookie("lang", lang, 150);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue