mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
remove rtl handling from locale plugin
This commit is contained in:
parent
a0746ff192
commit
d3d7769f81
1 changed files with 12 additions and 13 deletions
|
@ -3,7 +3,7 @@ import { LOCALES } from "./available-locales";
|
|||
|
||||
export const useLocales = () => {
|
||||
const i18n = useI18n();
|
||||
const { current: vuetifyLocale, isRtl } = useLocale();
|
||||
const { current: vuetifyLocale } = useLocale();
|
||||
|
||||
const locale = computed<LocaleObject["code"]>({
|
||||
get: () => i18n.locale.value,
|
||||
|
@ -11,22 +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;
|
||||
const currentLocale = LOCALES.find(lc => lc.value === vuetifyLocale.value);
|
||||
if (currentLocale) {
|
||||
isRtl.value = currentLocale.dir === "rtl";
|
||||
}
|
||||
|
||||
useHead({
|
||||
htmlAttrs: {
|
||||
lang: lc,
|
||||
dir: isRtl.value ? "rtl" : "ltr",
|
||||
},
|
||||
})
|
||||
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