adds rtl for admin ui (#30965)
part of: #29974 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
59e1b4271a
commit
b215e64cf4
1 changed files with 19 additions and 0 deletions
|
@ -11,6 +11,22 @@ import { DEFAULT_LOCALE, i18n } from "../../i18n/i18n";
|
||||||
import { useFetch } from "../../utils/useFetch";
|
import { useFetch } from "../../utils/useFetch";
|
||||||
import { useRealm } from "../realm-context/RealmContext";
|
import { useRealm } from "../realm-context/RealmContext";
|
||||||
|
|
||||||
|
// can be replaced with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
|
||||||
|
const RTL_LOCALES = [
|
||||||
|
"ar",
|
||||||
|
"dv",
|
||||||
|
"fa",
|
||||||
|
"ha",
|
||||||
|
"he",
|
||||||
|
"iw",
|
||||||
|
"ji",
|
||||||
|
"ps",
|
||||||
|
"sd",
|
||||||
|
"ug",
|
||||||
|
"ur",
|
||||||
|
"yi",
|
||||||
|
];
|
||||||
|
|
||||||
export class WhoAmI {
|
export class WhoAmI {
|
||||||
#me?: WhoAmIRepresentation;
|
#me?: WhoAmIRepresentation;
|
||||||
|
|
||||||
|
@ -22,6 +38,9 @@ export class WhoAmI {
|
||||||
console.warn("Error(s) loading locale", this.#me?.locale, error);
|
console.warn("Error(s) loading locale", this.#me?.locale, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (RTL_LOCALES.includes(this.#me.locale)) {
|
||||||
|
document.getElementsByTagName("html")[0].setAttribute("dir", "rtl");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue