1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

fix: RTL Settings Ignored (#5762)

This commit is contained in:
Michael Genson 2025-07-21 02:51:28 -05:00 committed by GitHub
parent a1a45078fb
commit 00a03559ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 126 additions and 148 deletions

View file

@ -3,8 +3,6 @@ import { LOCALES } from "./available-locales";
export const useLocales = () => {
const i18n = useI18n();
const { isRtl } = useRtl();
const { current: vuetifyLocale } = useLocale();
const locale = computed<LocaleObject["code"]>({
@ -13,18 +11,21 @@ export const useLocales = () => {
i18n.setLocale(value);
},
});
function updateLocale(lc: LocaleObject["code"]) {
vuetifyLocale.value = lc;
}
// auto update vuetify locale
watch(locale, (lc) => {
vuetifyLocale.value = lc;
});
// auto update rtl
watch(vuetifyLocale, (vl) => {
const currentLocale = LOCALES.find(lc => lc.value === vl);
if (currentLocale) {
isRtl.value = currentLocale.dir === "rtl";
}
updateLocale(lc);
});
// set initial locale
if (i18n.locale.value) {
updateLocale(i18n.locale.value);
};
return {
locale,
locales: LOCALES,