From 3ef836813050bd5578fc0a958a728d50201f05e4 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 26 Aug 2025 10:05:25 -0600 Subject: [PATCH] Improved locale/rtl handling. Whole calendar now flips RTL --- index.html | 12 +++--------- src/App.vue | 3 +++ src/components/CalendarView.vue | 3 ++- src/components/EventOverlay.vue | 1 + src/utils/locale.js | 4 ++++ 5 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 src/utils/locale.js diff --git a/index.html b/index.html index 1506caa..3ceea3f 100644 --- a/index.html +++ b/index.html @@ -1,12 +1,6 @@ - - + Calendar - - - -
- - - + +
\ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 5836a2c..4c0fe18 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,6 +3,7 @@ import { ref, onMounted, onBeforeUnmount } from 'vue' import CalendarView from './components/CalendarView.vue' import EventDialog from './components/EventDialog.vue' import { useCalendarStore } from './stores/CalendarStore' +import { lang } from './utils/locale' const eventDialog = ref(null) const calendarStore = useCalendarStore() @@ -35,6 +36,8 @@ function handleGlobalKey(e) { onMounted(() => { calendarStore.initializeHolidaysFromConfig() document.addEventListener('keydown', handleGlobalKey, { passive: false }) + // Set document language via shared util + if (lang) document.documentElement.setAttribute('lang', lang) }) onBeforeUnmount(() => { diff --git a/src/components/CalendarView.vue b/src/components/CalendarView.vue index 387f5d7..aa57e68 100644 --- a/src/components/CalendarView.vue +++ b/src/components/CalendarView.vue @@ -13,6 +13,7 @@ import { daysInclusive, addDaysStr, MIN_YEAR, MAX_YEAR } from '@/utils/date' import { toLocalString, fromLocalString, DEFAULT_TZ } from '@/utils/date' import { addDays, differenceInWeeks } from 'date-fns' import { createVirtualWeekManager } from '@/plugins/virtualWeeks' +import { rtl } from '@/utils/locale' const calendarStore = useCalendarStore() const emit = defineEmits(['create-event', 'edit-event']) @@ -433,7 +434,7 @@ window.addEventListener('resize', () => {