diff --git a/messages/en-US.json b/messages/en-US.json index 8414f0a2f..3b4372361 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -3142,5 +3142,35 @@ "idpDeleteAllOrgsMenu": "Delete", "publicIpEndpoint": "Endpoint", "lastTriggeredAt": "Last Trigger", - "reject": "Reject" + "reject": "Reject", + "uptimeDaysAgo": "{count} days ago", + "uptimeToday": "Today", + "uptimeNoDataAvailable": "No data available", + "uptimeSuffix": "uptime", + "uptimeDowntimeSuffix": "downtime", + "uptimeTooltipUptimeLabel": "Uptime", + "uptimeTooltipDowntimeLabel": "Downtime", + "uptimeOngoing": "ongoing", + "uptimeNoMonitoringData": "No monitoring data", + "uptimeNoData": "No data", + "uptimeMiniBarDown": "Down", + "uptimeSectionTitle": "Uptime", + "uptimeSectionDescription": "Site availability over the last {days} days.", + "uptimeAddAlert": "Add Alert", + "uptimeViewAlerts": "View Alerts", + "uptimeCreateEmailAlert": "Create Email Alert", + "uptimeAlertDescriptionSite": "Get notified by email when this site goes offline or comes back online.", + "uptimeAlertDescriptionResource": "Get notified by email when this resource goes offline or comes back online.", + "uptimeAlertNamePlaceholder": "Alert name", + "uptimeAdditionalEmails": "Additional Emails", + "uptimeCreateAlert": "Create Alert", + "uptimeAlertNoRecipients": "No recipients", + "uptimeAlertNoRecipientsDescription": "Please add at least one user, role, or email to notify.", + "uptimeAlertCreated": "Alert created", + "uptimeAlertCreatedDescription": "You will be notified when this changes status.", + "uptimeAlertCreateFailed": "Failed to create alert", + "webhookUrlLabel": "URL", + "webhookHeaderKeyPlaceholder": "Key", + "webhookHeaderValuePlaceholder": "Value", + "alertLabel": "Alert" } diff --git a/src/components/UptimeAlertSection.tsx b/src/components/UptimeAlertSection.tsx index 31b7b742d..96a6dc286 100644 --- a/src/components/UptimeAlertSection.tsx +++ b/src/components/UptimeAlertSection.tsx @@ -34,6 +34,7 @@ import { orgQueries } from "@app/lib/queries"; import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert"; import { usePaidStatus } from "@app/hooks/usePaidStatus"; import { tierMatrix } from "@server/lib/billing/tierMatrix"; +import { useTranslations } from "next-intl"; interface UptimeAlertSectionProps { orgId: string; @@ -50,6 +51,7 @@ export default function UptimeAlertSection({ resourceId, days = 90 }: UptimeAlertSectionProps) { + const t = useTranslations(); const api = createApiClient(useEnvContext()); const queryClient = useQueryClient(); const { isPaidUser } = usePaidStatus(); @@ -57,7 +59,7 @@ export default function UptimeAlertSection({ const [open, setOpen] = useState(false); const [name, setName] = useState( - `${siteId ? "Site" : "Resource"} ${startingName} Alert` + `${siteId ? t("site") : t("resource")} ${startingName} ${t("alertLabel")}` ); const [userTags, setUserTags] = useState([]); const [roleTags, setRoleTags] = useState([]); @@ -112,9 +114,8 @@ export default function UptimeAlertSection({ ) { toast({ variant: "destructive", - title: "No recipients", - description: - "Please add at least one user, role, or email to notify." + title: t("uptimeAlertNoRecipients"), + description: t("uptimeAlertNoRecipientsDescription") }); return; } @@ -136,12 +137,12 @@ export default function UptimeAlertSection({ }); toast({ - title: "Alert created", - description: "You will be notified when this changes status." + title: t("uptimeAlertCreated"), + description: t("uptimeAlertCreatedDescription") }); setOpen(false); - setName("Uptime Alert"); + setName(t("uptimeSectionTitle")); setUserTags([]); setRoleTags([]); setEmailTags([]); @@ -156,8 +157,8 @@ export default function UptimeAlertSection({ } catch (e) { toast({ variant: "destructive", - title: "Failed to create alert", - description: formatAxiosError(e, "An error occurred.") + title: t("uptimeAlertCreateFailed"), + description: formatAxiosError(e, t("errorOccurred")) }); } setLoading(false); @@ -174,19 +175,19 @@ export default function UptimeAlertSection({ const alertButton = alertRulesLoading ? ( ) : hasRules ? ( ) : ( ); @@ -196,9 +197,11 @@ export default function UptimeAlertSection({
- Uptime + + {t("uptimeSectionTitle")} + - Availability over the last {days} days + {t("uptimeSectionDescription", { days })}
{alertButton} @@ -216,11 +219,13 @@ export default function UptimeAlertSection({ - Create Email Alert + + {t("uptimeCreateEmailAlert")} + - Get notified by email when this{" "} - {siteId ? "site" : "resource"} goes offline or comes - back online. + {siteId + ? t("uptimeAlertDescriptionSite") + : t("uptimeAlertDescriptionResource")} @@ -232,20 +237,22 @@ export default function UptimeAlertSection({ >
- + setName(e.target.value)} - placeholder="Alert name" + placeholder={t("uptimeAlertNamePlaceholder")} />
- + { @@ -263,11 +270,11 @@ export default function UptimeAlertSection({ />
- + { @@ -285,11 +292,11 @@ export default function UptimeAlertSection({ />
- + { @@ -313,14 +320,14 @@ export default function UptimeAlertSection({ - + diff --git a/src/components/UptimeBar.tsx b/src/components/UptimeBar.tsx index 992484ea4..5bd5ce3f1 100644 --- a/src/components/UptimeBar.tsx +++ b/src/components/UptimeBar.tsx @@ -10,6 +10,7 @@ import { import { useEnvContext } from "@app/hooks/useEnvContext"; import { createApiClient } from "@app/lib/api"; import { cn } from "@app/lib/cn"; +import { useTranslations } from "next-intl"; function formatDuration(seconds: number): string { if (seconds === 0) return "0s"; @@ -63,6 +64,7 @@ export default function UptimeBar({ title, className }: UptimeBarProps) { + const t = useTranslations(); const api = createApiClient(useEnvContext()); const siteQuery = useQuery({ @@ -104,7 +106,7 @@ export default function UptimeBar({
@@ -122,8 +124,8 @@ export default function UptimeBar({ ))}
- {days} days ago - Today + {t("uptimeDaysAgo", { count: days })} + {t("uptimeToday")}
); @@ -145,7 +147,7 @@ export default function UptimeBar({ {data.overallUptimePercent.toFixed(2)}% {" "} - uptime + {t("uptimeSuffix")} {data.totalDowntimeSeconds > 0 && ( @@ -154,14 +156,14 @@ export default function UptimeBar({ data.totalDowntimeSeconds )} {" "} - downtime + {t("uptimeDowntimeSuffix")} )} )} {allNoData && ( - No data available + {t("uptimeNoDataAvailable")} )}
@@ -188,7 +190,7 @@ export default function UptimeBar({
{day.status !== "no_data" && (
- Uptime:{" "} + {t("uptimeTooltipUptimeLabel")}:{" "} {day.uptimePercent.toFixed(1)}% @@ -196,7 +198,7 @@ export default function UptimeBar({ )} {day.totalDowntimeSeconds > 0 && (
- Downtime:{" "} + {t("uptimeTooltipDowntimeLabel")}:{" "} {formatDuration( day.totalDowntimeSeconds @@ -214,7 +216,7 @@ export default function UptimeBar({ {formatTime(w.start)} {w.end ? ` – ${formatTime(w.end)}` - : " – ongoing"}{" "} + : ` – ${t("uptimeOngoing")}`}{" "} ({w.status}) @@ -224,7 +226,7 @@ export default function UptimeBar({ )} {day.status === "no_data" && (
- No monitoring data + {t("uptimeNoMonitoringData")}
)} @@ -234,9 +236,9 @@ export default function UptimeBar({ {/* Date labels */}
- {days} days ago - Today + {t("uptimeDaysAgo", { count: days })} + {t("uptimeToday")}
); -} +} \ No newline at end of file diff --git a/src/components/UptimeMiniBar.tsx b/src/components/UptimeMiniBar.tsx index 5baabb4dd..b4c8aa3bd 100644 --- a/src/components/UptimeMiniBar.tsx +++ b/src/components/UptimeMiniBar.tsx @@ -10,6 +10,7 @@ import { import { useEnvContext } from "@app/hooks/useEnvContext"; import { createApiClient } from "@app/lib/api"; import { cn } from "@app/lib/cn"; +import { useTranslations } from "next-intl"; function formatDuration(seconds: number): string { if (seconds === 0) return "0s"; @@ -51,6 +52,7 @@ export default function UptimeMiniBar({ healthCheckId, days = 30 }: UptimeMiniBarProps) { + const t = useTranslations(); const api = createApiClient(useEnvContext()); const siteQuery = useQuery({ @@ -105,7 +107,7 @@ export default function UptimeMiniBar({ @@ -136,12 +138,12 @@ export default function UptimeMiniBar({
{day.status === "no_data" - ? "No data" - : `${day.uptimePercent.toFixed(1)}% uptime`} + ? t("uptimeNoData") + : `${day.uptimePercent.toFixed(1)}% ${t("uptimeSuffix")}`}
{day.totalDowntimeSeconds > 0 && (
- Down:{" "} + {t("uptimeMiniBarDown")}:{" "} {formatDuration(day.totalDowntimeSeconds)}
)} @@ -151,9 +153,9 @@ export default function UptimeMiniBar({ {allNoData - ? "No data" + ? t("uptimeNoData") : `${data.overallUptimePercent.toFixed(1)}%`} ); -} +} \ No newline at end of file diff --git a/src/components/alert-rule-editor/AlertRuleFields.tsx b/src/components/alert-rule-editor/AlertRuleFields.tsx index bb99d57f3..e9056256b 100644 --- a/src/components/alert-rule-editor/AlertRuleFields.tsx +++ b/src/components/alert-rule-editor/AlertRuleFields.tsx @@ -714,7 +714,7 @@ function WebhookActionFields({ name={`actions.${index}.url`} render={({ field }) => ( - URL + {t("webhookUrlLabel")} ( - + )} @@ -972,7 +972,7 @@ function WebhookHeadersField({ render={({ field }) => ( - + )}