mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
feat:#16 added translation for button and toast
This commit is contained in:
@ -27,7 +27,8 @@
|
||||
"dropDownSelect": "Bitte wähle einen Raum aus",
|
||||
"noRoomsAvailable": "Keine Räume verfügbar",
|
||||
"available": "verfügbar",
|
||||
"occupied": "belegt"
|
||||
"occupied": "belegt",
|
||||
"roomIcal": "iCal für "
|
||||
},
|
||||
"freeRooms": {
|
||||
"freeRooms": "Freie Räume",
|
||||
|
@ -27,7 +27,8 @@
|
||||
"dropDownSelect": "please select a room",
|
||||
"noRoomsAvailable": "no rooms listed",
|
||||
"available": "available",
|
||||
"occupied": "occupied"
|
||||
"occupied": "occupied",
|
||||
"roomIcal": "iCal for "
|
||||
},
|
||||
"freeRooms": {
|
||||
"freeRooms": "free rooms",
|
||||
|
@ -23,6 +23,28 @@ import DynamicPage from "@/view/DynamicPage.vue";
|
||||
import RoomOccupation from "@/components/RoomOccupation.vue";
|
||||
import { computedAsync } from "@vueuse/core";
|
||||
import { router } from "@/main";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useToast } from "primevue/usetoast";
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
const toast = useToast();
|
||||
|
||||
const show = () => {
|
||||
toast.add({
|
||||
severity: "info",
|
||||
summary: t("calendarLink.copyToastSummary"),
|
||||
detail: t("calendarLink.copyToastNotification"),
|
||||
life: 3000,
|
||||
});
|
||||
};
|
||||
|
||||
const failedClipboard = () => {
|
||||
toast.add({
|
||||
severity: "error",
|
||||
summary: t("calendarLink.copyToastError"),
|
||||
detail: t("calendarLink.copyToastErrorDetail"),
|
||||
life: 3000,
|
||||
});
|
||||
};
|
||||
|
||||
type Room = {
|
||||
name: string;
|
||||
@ -90,13 +112,13 @@ const getLink = (selectedRoom: string) =>
|
||||
|
||||
const button = computed(() => {
|
||||
return {
|
||||
label: "Copy iCal Link for" + selectedRoom.value.name,
|
||||
icon: "pi pi-calendar",
|
||||
label: t("roomFinderPage.roomIcal") + selectedRoom.value.name,
|
||||
icon: "pi pi-clone",
|
||||
disabled: selectedRoom.value.name === "",
|
||||
onClick: () => {
|
||||
// Copy iCal link to clipboard
|
||||
// localhost/api/feed/room?id=selectedRoom.value.name
|
||||
navigator.clipboard.writeText(getLink(selectedRoom.value.name));
|
||||
navigator.clipboard.writeText(getLink(selectedRoom.value.name)).then(show, () => failedClipboard())
|
||||
},
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user