mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Flip arrows of Bootstrap-styled <select>
s for RTL langs (#1526)
* Flip arrows of Bootstrap-styled <select>s for RTL langs * Use the dir attribute to set document direction * Remove unused variable and fix use of CSS var
This commit is contained in:
parent
cee57f4cb7
commit
b3ea7288ab
3 changed files with 16 additions and 8 deletions
|
@ -438,15 +438,9 @@ div[contenteditable="true"]:focus {{
|
||||||
|
|
||||||
window_bg_day = self.get_window_bg_color(False).name()
|
window_bg_day = self.get_window_bg_color(False).name()
|
||||||
window_bg_night = self.get_window_bg_color(True).name()
|
window_bg_night = self.get_window_bg_color(True).name()
|
||||||
body_bg = window_bg_night if theme_manager.night_mode else window_bg_day
|
|
||||||
|
|
||||||
if is_rtl(anki.lang.current_lang):
|
|
||||||
lang_dir = "rtl"
|
|
||||||
else:
|
|
||||||
lang_dir = "ltr"
|
|
||||||
|
|
||||||
return f"""
|
return f"""
|
||||||
body {{ zoom: {zoom}; background-color: --window-bg; direction: {lang_dir}; }}
|
body {{ zoom: {zoom}; background-color: var(--window-bg); }}
|
||||||
html {{ {font} }}
|
html {{ {font} }}
|
||||||
{button_style}
|
{button_style}
|
||||||
:root {{ --window-bg: {window_bg_day} }}
|
:root {{ --window-bg: {window_bg_day} }}
|
||||||
|
@ -496,9 +490,14 @@ html {{ {font} }}
|
||||||
else:
|
else:
|
||||||
doc_class = ""
|
doc_class = ""
|
||||||
|
|
||||||
|
if is_rtl(anki.lang.current_lang):
|
||||||
|
lang_dir = "rtl"
|
||||||
|
else:
|
||||||
|
lang_dir = "ltr"
|
||||||
|
|
||||||
html = f"""
|
html = f"""
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html class="{doc_class}">
|
<html class="{doc_class}" dir="{lang_dir}">
|
||||||
<head>
|
<head>
|
||||||
<title>{self.title}</title>
|
<title>{self.title}</title>
|
||||||
{head}
|
{head}
|
||||||
|
|
|
@ -68,3 +68,10 @@ samp {
|
||||||
.isLin {
|
.isLin {
|
||||||
--base-font-size: 14px;
|
--base-font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir=rtl] {
|
||||||
|
.form-select {
|
||||||
|
/* flip <select>'s arrow */
|
||||||
|
background-position: left .75rem center;
|
||||||
|
}
|
||||||
|
}
|
|
@ -88,4 +88,6 @@ export async function setupI18n(args: { modules: ModuleName[] }): Promise<void>
|
||||||
|
|
||||||
setBundles(newBundles);
|
setBundles(newBundles);
|
||||||
langs = json.langs;
|
langs = json.langs;
|
||||||
|
|
||||||
|
document.dir = direction();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue