From 15ce9217143420446838ac3789309332a4f45dc4 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 12 Sep 2022 22:51:29 +0300 Subject: [PATCH] [all] function to check 'isRtl' flag --- apps/common/locale.js | 7 ++++++- apps/common/main/lib/util/utils.js | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/common/locale.js b/apps/common/locale.js index db8f29318..608c33087 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -167,10 +167,15 @@ Common.Locale = new(function() { } else require(polyfills, _requireLang); } else _requireLang(); + const _isCurrentRtl = function () { + return false; + }; + return { apply: _applyLocalization, get: _get, - getCurrentLanguage: _getCurrentLanguage + getCurrentLanguage: _getCurrentLanguage, + isCurrentLanguageRtl: _isCurrentRtl }; })(); diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 03aac86ae..645d7f3b5 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -1091,4 +1091,13 @@ Common.Utils.getKeyByValue = function(obj, value) { return prop; } } +}; + +Common.UI.isRTL = function () { + if ( window.isrtl == undefined ) { + window.isrtl = Common.localStorage.itemExists('ui-rtl') ? + Common.localStorage.getBool("ui-rtl") : Common.Locale.isCurrentLanguageRtl(); + } + + return window.isrtl; }; \ No newline at end of file