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:
Erik Jan de Wit 2024-07-23 14:05:11 +02:00 committed by GitHub
parent 59e1b4271a
commit b215e64cf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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");
}
} }
} }