From 310084a902ab53fc2096ca926acb007b63351b05 Mon Sep 17 00:00:00 2001 From: mohadeseh safari Date: Tue, 24 Jun 2025 15:30:52 -0400 Subject: [PATCH] translation fix --- .../Components/MonitorsTableMenu/index.jsx | 28 +++++++++++-------- client/src/locales/en.json | 9 ++++++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx b/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx index 76440f02d..87a870d09 100644 --- a/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx +++ b/client/src/Pages/Infrastructure/Monitors/Components/MonitorsTableMenu/index.jsx @@ -10,6 +10,7 @@ import PropTypes from "prop-types"; import Dialog from "../../../../../Components/Dialog"; import { networkService } from "../../../../../Utils/NetworkService.js"; import { usePauseMonitor } from "../../../../../Hooks/monitorHooks"; +import { useTranslation } from "react-i18next"; /** * InfrastructureMenu Component @@ -31,6 +32,7 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => { const [isDialogOpen, setIsDialogOpen] = useState(false); const theme = useTheme(); const [pauseMonitor] = usePauseMonitor(); + const { t } = useTranslation(); const openMenu = (e) => { e.stopPropagation(); @@ -64,12 +66,16 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => { try { await pauseMonitor({ monitorId: monitor.id }); createToast({ - body: `Monitor ${monitor.isActive ? "paused" : "resumed"} successfully.`, + body: t("monitorActions.pauseResumeSuccess", "Monitor {{action}} successfully", { + action: monitor.isActive ? t("monitorActions.paused", "paused") : t("monitorActions.resumed", "resumed") + }), }); updateCallback(); } catch (error) { createToast({ - body: `Failed to ${monitor.isActive ? "pause" : "resume"} monitor.`, + body: t("monitorActions.pauseResumeFailed", "Failed to {{action}} monitor", { + action: monitor.isActive ? t("pause", "pause") : t("resume", "resume") + }), }); } }; @@ -79,9 +85,9 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => { await networkService.deleteMonitorById({ monitorId: monitor.id, }); - createToast({ body: "Monitor deleted successfully." }); + createToast({ body: t("monitorActions.deleteSuccess", "Monitor deleted successfully") }); } catch (error) { - createToast({ body: "Failed to delete monitor." }); + createToast({ body: t("monitorActions.deleteFailed", "Failed to delete monitor") }); } finally { setIsDialogOpen(false); updateCallback(); @@ -125,13 +131,13 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => { }, }} > - openDetails(monitor.id)}>Details + openDetails(monitor.id)}>{t("monitorActions.details", "Details")} {isAdmin && ( - openConfigure(monitor.id)}>Configure + openConfigure(monitor.id)}>{t("configure", "Configure")} )} {isAdmin && ( - {monitor.isActive ? "Pause" : "Resume"} + {monitor.isActive ? t("pause", "Pause") : t("resume", "Resume")} )} {isAdmin && ( @@ -139,17 +145,17 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => { onClick={openRemove} sx={{ color: theme.palette.error.main }} > - Remove + {t("remove", "Remove")} )}