Open rtl mode for ar lang

This commit is contained in:
Julia Radzhabova
2023-11-20 13:32:22 +03:00
parent b7ec19f8f5
commit 9ccfa2cd73
3 changed files with 8 additions and 3 deletions

View File

@ -171,7 +171,7 @@ Common.Locale = new(function() {
} else _requireLang();
const _isCurrentRtl = function () {
return false;
return currentLang && (/^(ar)$/i.test(currentLang));
};
return {

View File

@ -39,7 +39,12 @@ var checkLocalStorage = (function () {
}
})();
if ( checkLocalStorage && localStorage.getItem("ui-rtl") === '1' ) {
if (!lang) {
lang = (/(?:&|^)lang=([^&]+)&?/i).exec(window.location.search.substring(1));
lang = lang ? lang[1] : '';
}
lang && (lang = lang.split(/[\-\_]/)[0].toLowerCase());
if ( checkLocalStorage && localStorage.getItem("ui-rtl") === '1' || (!checkLocalStorage || localStorage.getItem("ui-rtl") === null) && lang==='ar') {
document.body.setAttribute('dir', 'rtl');
document.body.classList.add('rtl');
}

View File

@ -1199,7 +1199,7 @@ Common.Utils.getKeyByValue = function(obj, value) {
!Common.UI && (Common.UI = {});
Common.UI.isRTL = function () {
if ( window.isrtl == undefined ) {
if ( window.isrtl === undefined ) {
window.isrtl = Common.localStorage.itemExists('ui-rtl') ?
Common.localStorage.getBool("ui-rtl") : Common.Locale.isCurrentLanguageRtl();
}