mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-28 01:38:01 +08:00
[common] Add rtl option blocking for non-rtl languages
This commit is contained in:
@ -24,8 +24,18 @@ function isLocalStorageAvailable() {
|
||||
}
|
||||
}
|
||||
|
||||
if(!window.lang) {
|
||||
window.lang = (/(?:&|^)lang=([^&]+)&?/i).exec(window.location.search.substring(1));
|
||||
window.lang = window.lang ? window.lang[1] : '';
|
||||
}
|
||||
|
||||
window.lang && (window.lang = window.lang.split(/[\-\_]/)[0].toLowerCase());
|
||||
|
||||
if(isLocalStorageAvailable()) {
|
||||
if(localStorage.getItem('mobile-mode-direction') === 'rtl') {
|
||||
const modeDirection = localStorage.getItem('mobile-mode-direction');
|
||||
|
||||
if(modeDirection === 'rtl' || (window.lang === 'ar' && !modeDirection)) {
|
||||
!modeDirection && localStorage.setItem('mobile-mode-direction', 'rtl');
|
||||
load_stylesheet('./css/framework7-rtl.css');
|
||||
document.body.classList.add('rtl');
|
||||
} else {
|
||||
|
||||
@ -25,6 +25,8 @@ const PageApplicationSettings = props => {
|
||||
|
||||
// set mode
|
||||
const appOptions = props.storeAppOptions;
|
||||
const currentLang = appOptions.lang;
|
||||
const isRtlLang = currentLang && /^(ar)$/i.test(currentLang);
|
||||
const colorTheme = storeThemes.colorTheme;
|
||||
const themes = storeThemes.themes;
|
||||
const typeTheme = colorTheme.type;
|
||||
@ -112,23 +114,27 @@ const PageApplicationSettings = props => {
|
||||
}}></ListItem>
|
||||
</List>
|
||||
}
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
{isRtlLang &&
|
||||
<>
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
</>
|
||||
}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
@ -19,6 +19,8 @@ const PageApplicationSettings = props => {
|
||||
|
||||
// set mode
|
||||
const appOptions = props.storeAppOptions;
|
||||
const currentLang = appOptions.lang;
|
||||
const isRtlLang = currentLang && /^(ar)$/i.test(currentLang);
|
||||
const storeThemes = props.storeThemes;
|
||||
const colorTheme = storeThemes.colorTheme;
|
||||
const themes = storeThemes.themes;
|
||||
@ -66,23 +68,27 @@ const PageApplicationSettings = props => {
|
||||
setMacrosSettings: props.setMacrosSettings
|
||||
}}></ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("View.Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('View.Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
{isRtlLang &&
|
||||
<>
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("View.Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('View.Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
</>
|
||||
}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
@ -31,6 +31,8 @@ const PageApplicationSettings = props => {
|
||||
// set mode
|
||||
const appOptions = props.storeAppOptions;
|
||||
const storeThemes = props.storeThemes;
|
||||
const currentLang = appOptions.lang;
|
||||
const isRtlLang = currentLang && /^(ar)$/i.test(currentLang);
|
||||
const colorTheme = storeThemes.colorTheme;
|
||||
const themes = storeThemes.themes;
|
||||
const isConfigSelectTheme = storeThemes.isConfigSelectTheme;
|
||||
@ -109,23 +111,27 @@ const PageApplicationSettings = props => {
|
||||
onChangeMacrosSettings: props.onChangeMacrosSettings
|
||||
}}></ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("View.Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('View.Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
{isRtlLang &&
|
||||
<>
|
||||
<List>
|
||||
<ListItem>
|
||||
<div>
|
||||
<span>{t("View.Settings.textRtlInterface")}</span>
|
||||
<span className="beta-badge">Beta</span>
|
||||
</div>
|
||||
<Toggle checked={directionMode !== 'ltr'}
|
||||
onToggleChange={() => {
|
||||
storeApplicationSettings.changeDirectionMode(newDirectionMode);
|
||||
props.changeDirectionMode(newDirectionMode);
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Block>
|
||||
<p>{t('View.Settings.textExplanationChangeDirection')}</p>
|
||||
</Block>
|
||||
</>
|
||||
}
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user