You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
opt: refine rtl related code
This commit is contained in:
@@ -101,23 +101,8 @@ export async function loadTranslations() {
|
||||
|
||||
// Support for rtl language
|
||||
const isRTL = rtlLang.includes(lang.split('-')[0]);
|
||||
if (isRTL) {
|
||||
document.documentElement.setAttribute('dir', 'rtl');
|
||||
document.documentElement.setAttribute('lang', lang);
|
||||
|
||||
// Load extra rtl css
|
||||
fetch('styles/rtl_styles.css')
|
||||
.then(res => res.text())
|
||||
.then(css => {
|
||||
const style = document.createElement('style');
|
||||
style.textContent = css;
|
||||
document.head.appendChild(style);
|
||||
});
|
||||
} else {
|
||||
document.documentElement.setAttribute('dir', 'ltr');
|
||||
document.documentElement.setAttribute('lang', lang);
|
||||
}
|
||||
|
||||
document.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
|
||||
|
||||
// Generate language menu
|
||||
await generateLanguageMenu();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user