diff --git a/apps/common/locale.js b/apps/common/locale.js index 14042a4511..56dc8818b2 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -171,7 +171,7 @@ Common.Locale = new(function() { } else _requireLang(); const _isCurrentRtl = function () { - return false; + return currentLang && (/^(ar)$/i.test(currentLang)); }; return { diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index 37d53c3f7c..a8cfa7bbed 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -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'); } diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 20f5fac76e..02ad13bebc 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -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(); }