diff --git a/apps/common/mobile/utils/htmlutils.js b/apps/common/mobile/utils/htmlutils.js index d7b448e1d6..3fb8f384b5 100644 --- a/apps/common/mobile/utils/htmlutils.js +++ b/apps/common/mobile/utils/htmlutils.js @@ -24,8 +24,22 @@ function isLocalStorageAvailable() { } } +{ + let lang = (/(?:&|^)lang=([^&]+)&?/i).exec(window.location.search.substring(1)); + lang = ((lang && lang[1]) || window.Common.Locale.defaultLang).split(/[\-\_]/)[0]; + Common.Locale.currentLang = lang; + Common.Locale.isCurrentLangRtl = lang.lastIndexOf('ar', 0) === 0; +} + if(isLocalStorageAvailable()) { - if(localStorage.getItem('mobile-mode-direction') === 'rtl') { + let modeDirection = localStorage.getItem('mobile-mode-direction'); + + if(!modeDirection && Common.Locale.isCurrentLangRtl) { + localStorage.setItem('mobile-mode-direction', 'rtl'); + modeDirection = 'rtl'; + } + + if(modeDirection === 'rtl') { load_stylesheet('./css/framework7-rtl.css'); document.body.classList.add('rtl'); } else { diff --git a/apps/documenteditor/mobile/src/index_dev.html b/apps/documenteditor/mobile/src/index_dev.html index 83d28bd8ab..9fdd8137a0 100644 --- a/apps/documenteditor/mobile/src/index_dev.html +++ b/apps/documenteditor/mobile/src/index_dev.html @@ -23,6 +23,9 @@ + <% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %> diff --git a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx index 80ed1e26a5..32175a75d8 100644 --- a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -112,23 +112,27 @@ const PageApplicationSettings = props => { }}> } - - -
- {t("Settings.textRtlInterface")} - Beta -
- { - storeApplicationSettings.changeDirectionMode(newDirectionMode); - props.changeDirectionMode(newDirectionMode); - }} - /> -
-
- -

{t('Settings.textExplanationChangeDirection')}

-
+ {Common.Locale.isCurrentLangRtl && + <> + + +
+ {t("Settings.textRtlInterface")} + Beta +
+ { + storeApplicationSettings.changeDirectionMode(newDirectionMode); + props.changeDirectionMode(newDirectionMode); + }} + /> +
+
+ +

{t('Settings.textExplanationChangeDirection')}

+
+ + } ); }; diff --git a/apps/presentationeditor/mobile/src/index_dev.html b/apps/presentationeditor/mobile/src/index_dev.html index d5996c2973..9dc9765a05 100644 --- a/apps/presentationeditor/mobile/src/index_dev.html +++ b/apps/presentationeditor/mobile/src/index_dev.html @@ -24,6 +24,9 @@ + <% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %> diff --git a/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx index 23012d14a5..5936fefddb 100644 --- a/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -27,7 +27,6 @@ const PageApplicationSettings = props => { const _isEdit = appOptions.isEdit; // const _isShowMacros = (!appOptions.isDisconnected && appOptions.customization) ? appOptions.customization.macros !== false : true; - return ( @@ -66,23 +65,27 @@ const PageApplicationSettings = props => { setMacrosSettings: props.setMacrosSettings }}> - - -
- {t("View.Settings.textRtlInterface")} - Beta -
- { - storeApplicationSettings.changeDirectionMode(newDirectionMode); - props.changeDirectionMode(newDirectionMode); - }} - /> -
-
- -

{t('View.Settings.textExplanationChangeDirection')}

-
+ {Common.Locale.isCurrentLangRtl && + <> + + +
+ {t("View.Settings.textRtlInterface")} + Beta +
+ { + storeApplicationSettings.changeDirectionMode(newDirectionMode); + props.changeDirectionMode(newDirectionMode); + }} + /> +
+
+ +

{t('View.Settings.textExplanationChangeDirection')}

+
+ + }
); }; diff --git a/apps/spreadsheeteditor/mobile/src/index_dev.html b/apps/spreadsheeteditor/mobile/src/index_dev.html index 3a7fab6c68..22fc7f954f 100644 --- a/apps/spreadsheeteditor/mobile/src/index_dev.html +++ b/apps/spreadsheeteditor/mobile/src/index_dev.html @@ -24,6 +24,9 @@ + <% if ( htmlWebpackPlugin.options.skeleton.htmlscript ) { %> diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx index cccb47d17f..064a4f7cec 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -109,23 +109,27 @@ const PageApplicationSettings = props => { onChangeMacrosSettings: props.onChangeMacrosSettings }}> - - -
- {t("View.Settings.textRtlInterface")} - Beta -
- { - storeApplicationSettings.changeDirectionMode(newDirectionMode); - props.changeDirectionMode(newDirectionMode); - }} - /> -
-
- -

{t('View.Settings.textExplanationChangeDirection')}

-
+ {Common.Locale.isCurrentLangRtl && + <> + + +
+ {t("View.Settings.textRtlInterface")} + Beta +
+ { + storeApplicationSettings.changeDirectionMode(newDirectionMode); + props.changeDirectionMode(newDirectionMode); + }} + /> +
+
+ +

{t('View.Settings.textExplanationChangeDirection')}

+
+ + } ); };