Merged in bugfix/VBV-385-struktur-ük-anpassen (pull request #101)
Lokalisation der notification timestamps Approved-by: Daniel Egger
This commit is contained in:
commit
7224d1c1df
|
|
@ -19,7 +19,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CourseSessionAttendanceCourse } from "@/types";
|
import type { CourseSessionAttendanceCourse } from "@/types";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import "dayjs/locale/de";
|
|
||||||
import LocalizedFormat from "dayjs/plugin/localizedFormat";
|
import LocalizedFormat from "dayjs/plugin/localizedFormat";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
|
@ -30,8 +29,7 @@ export interface Props {
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
dayjs.extend(LocalizedFormat);
|
dayjs.extend(LocalizedFormat);
|
||||||
dayjs.locale("de");
|
const format = "LLLL";
|
||||||
const format = "LLLL [Uhr]";
|
|
||||||
const start = computed(() => dayjs(props.attendanceCourse.start).format(format));
|
const start = computed(() => dayjs(props.attendanceCourse.start).format(format));
|
||||||
const end = computed(() => dayjs(props.attendanceCourse.end).format(format));
|
const end = computed(() => dayjs(props.attendanceCourse.end).format(format));
|
||||||
const location = computed(() => props.attendanceCourse.location);
|
const location = computed(() => props.attendanceCourse.location);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import log from "loglevel";
|
||||||
|
|
||||||
import { bustItGetCache, itGetCached, itPost } from "@/fetchHelpers";
|
import { bustItGetCache, itGetCached, itPost } from "@/fetchHelpers";
|
||||||
import { loadLocaleMessages, setI18nLanguage } from "@/i18n";
|
import { loadLocaleMessages, setI18nLanguage } from "@/i18n";
|
||||||
|
import dayjs from "dayjs";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
const logoutRedirectUrl = import.meta.env.VITE_LOGOUT_REDIRECT || "/";
|
const logoutRedirectUrl = import.meta.env.VITE_LOGOUT_REDIRECT || "/";
|
||||||
|
|
@ -36,6 +37,17 @@ const initialUserState: UserState = {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function setLocale(language: AvailableLanguages) {
|
async function setLocale(language: AvailableLanguages) {
|
||||||
|
switch (language) {
|
||||||
|
case "de":
|
||||||
|
await import("dayjs/locale/de");
|
||||||
|
break;
|
||||||
|
case "fr":
|
||||||
|
await import("dayjs/locale/fr");
|
||||||
|
break;
|
||||||
|
case "it":
|
||||||
|
await import("dayjs/locale/it");
|
||||||
|
}
|
||||||
|
dayjs.locale(language);
|
||||||
await loadLocaleMessages(language);
|
await loadLocaleMessages(language);
|
||||||
setI18nLanguage(language);
|
setI18nLanguage(language);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue