From 0daa6c5c8b57ad402bd65ff989ff03ba2fac0de1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 22 Nov 2024 21:52:06 +0300 Subject: [PATCH] Fix loading not-rtl language --- apps/common/locale.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/common/locale.js b/apps/common/locale.js index f8d01da102..01ffd7d39f 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -43,6 +43,7 @@ Common.Locale = new(function() { _4letterLangs = ['pt-pt', 'zh-tw', 'sr-cyrl']; var _applyLocalization = function(callback) { + _fixRtl(); try { callback && (loadcallback = callback); if (l10n) { @@ -160,6 +161,15 @@ Common.Locale = new(function() { }); }; + var _fixRtl = function(prop, scope) { + if (!_isCurrentRtl() && document.body.classList.contains('rtl')) { + document.body.removeAttribute('dir'); + document.body.classList.remove('rtl'); + document.body.classList.remove('rtl-font'); + document.body.setAttribute('applang', currentLang); + } + }; + if ( !window.fetch ) { /* use fetch polifill if native method isn't supported */ var polyfills = ['../vendor/fetch/fetch.umd'];