Translate radarr release strings
This commit is contained in:
parent
cd89b6d6e2
commit
017ed7932e
@ -748,5 +748,10 @@
|
||||
"seemsdown": "Seems Down",
|
||||
"down": "Down",
|
||||
"unknown": "Unknown"
|
||||
},
|
||||
"calendar": {
|
||||
"inCinemas": "In cinemas",
|
||||
"physicalRelease": "Physical release",
|
||||
"digitalRelease": "Digital release"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
import { DateTime } from "luxon";
|
||||
import { useEffect, useContext } from "react";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import useWidgetAPI from "../../../utils/proxy/use-widget-api";
|
||||
import { EventContext } from "../../../utils/contexts/calendar";
|
||||
import Error from "../../../components/services/widget/error";
|
||||
|
||||
export default function Integration({ config, params }) {
|
||||
const { t } = useTranslation();
|
||||
const { setEvents } = useContext(EventContext);
|
||||
const { data: radarrData, error: radarrError } = useWidgetAPI(config, "calendar",
|
||||
{ ...params, ...config?.params ?? {} }
|
||||
@ -18,9 +20,9 @@ export default function Integration({ config, params }) {
|
||||
const eventsToAdd = {};
|
||||
|
||||
radarrData?.forEach(event => {
|
||||
const cinemaTitle = `${event.title} - In cinemas`;
|
||||
const physicalTitle = `${event.title} - Physical release`;
|
||||
const digitalTitle = `${event.title} - Digital release`;
|
||||
const cinemaTitle = `${event.title} - ${t("calendar.inCinemas")}`;
|
||||
const physicalTitle = `${event.title} - ${t("calendar.physicalRelease")}`;
|
||||
const digitalTitle = `${event.title} - ${t("calendar.digitalRelease")}`;
|
||||
|
||||
eventsToAdd[cinemaTitle] = {
|
||||
title: cinemaTitle,
|
||||
@ -40,7 +42,7 @@ export default function Integration({ config, params }) {
|
||||
})
|
||||
|
||||
setEvents((prevEvents) => ({ ...prevEvents, ...eventsToAdd }));
|
||||
}, [radarrData, radarrError, config, setEvents]);
|
||||
}, [radarrData, radarrError, config, setEvents, t]);
|
||||
|
||||
const error = radarrError ?? radarrData?.error;
|
||||
return error && <Error error={{ message: `${config.type}: ${error.message ?? error}`}} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user