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