More bidi improvements

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-11-07 21:02:06 +01:00
parent 7a30c92651
commit 7c4a76cc89
48 changed files with 127 additions and 113 deletions

View File

@@ -67,6 +67,12 @@ function setLanguageInDOM(lang: string): void {
if (documentLang !== fixedLang) {
html.setAttribute("lang", fixedLang);
}
const direction = ["ar", "ae", "he", "fa", "ku", "ur"].includes(fixedLang)
? "rtl"
: "ltr";
console.debug("setDirection with", [fixedLang, direction]);
html.setAttribute("dir", direction);
}
function fileForLanguage(matches: Record<string, string>, lang: string) {