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:
parent
a1a45078fb
commit
00a03559ff
6 changed files with 126 additions and 148 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue