Add per account locale setting

Add a per user account setting for the locale so that the server can
correctly render pages with localized time formatting.
This commit is contained in:
Hornwitser 2025-06-13 21:50:22 +02:00
parent fad1bb2482
commit fb7a60db28
5 changed files with 28 additions and 0 deletions

View file

@ -8,6 +8,7 @@ export const useAccountStore = defineStore("account", () => {
id: ref<number>(),
name: ref<string>(),
timezone: ref<string>(),
locale: ref<string>(),
type: ref<ApiAccount["type"]>(),
interestedEventIds: ref<Set<number>>(new Set()),
interestedEventSlotIds: ref<Set<number>>(new Set()),
@ -19,6 +20,7 @@ export const useAccountStore = defineStore("account", () => {
state.id.value = account?.id;
state.name.value = account?.name;
state.timezone.value = account?.timezone;
state.locale.value = account?.locale;
state.type.value = account?.type;
state.interestedEventIds.value = new Set(account?.interestedEventIds ?? []);
state.interestedEventSlotIds.value = new Set(account?.interestedEventSlotIds ?? []);
@ -30,6 +32,8 @@ export const useAccountStore = defineStore("account", () => {
canEditPublic: computed(() => state.type.value === "admin"),
activeTimezone: computed(() => state.timezone.value || runtimeConfig.public.defaultTimezone),
defaultTimezone: computed(() => runtimeConfig.public.defaultTimezone),
activeLocale: computed(() => state.locale.value || runtimeConfig.public.defaultLocale),
defaultLocale: computed(() => runtimeConfig.public.defaultLocale),
};
const actions = {