From a8a4938c97fa4e30fc1a10dca5032e518bf1bdbf Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Mon, 10 Mar 2025 23:45:43 +0800
Subject: [PATCH] chore: fix some key not work
---
web/public/locales/en/views/live.json | 4 +
web/public/locales/zh-CN/common.json | 1 +
web/public/locales/zh-CN/views/live.json | 4 +
.../filter/CalendarFilterButton.tsx | 2 +-
.../components/filter/CameraGroupSelector.tsx | 32 ++--
.../components/filter/CamerasFilterButton.tsx | 6 +-
.../components/filter/ReviewFilterGroup.tsx | 4 +-
.../components/filter/SearchFilterGroup.tsx | 8 +-
web/src/components/filter/ZoneMaskFilter.tsx | 8 +-
web/src/components/input/SaveSearchDialog.tsx | 4 +-
web/src/components/menu/GeneralSettings.tsx | 2 +-
.../components/menu/SearchResultActions.tsx | 12 +-
web/src/components/navigation/NavItem.tsx | 2 +-
.../components/overlay/CameraInfoDialog.tsx | 6 +-
.../components/overlay/CreateUserDialog.tsx | 14 +-
.../components/overlay/DeleteUserDialog.tsx | 4 +-
web/src/components/overlay/ExportDialog.tsx | 2 +-
.../overlay/MobileReviewSettingsDrawer.tsx | 2 +-
.../components/overlay/RoleChangeDialog.tsx | 8 +-
.../components/overlay/SaveExportOverlay.tsx | 2 +-
.../components/overlay/SetPasswordDialog.tsx | 4 +-
.../overlay/detail/SearchDetailDialog.tsx | 6 +-
.../overlay/dialog/RestartDialog.tsx | 4 +-
.../overlay/dialog/SearchFilterDialog.tsx | 22 +--
.../overlay/dialog/TextEntryDialog.tsx | 4 +-
.../settings/CameraStreamingDialog.tsx | 20 ++-
.../settings/MotionMaskEditPane.tsx | 12 +-
.../settings/ObjectMaskEditPane.tsx | 6 +-
web/src/components/settings/PolygonItem.tsx | 12 +-
web/src/components/settings/ZoneEditPane.tsx | 16 +-
web/src/components/ui/calendar-range.tsx | 4 +-
web/src/pages/Exports.tsx | 6 +-
web/src/views/events/EventView.tsx | 6 +-
web/src/views/live/DraggableGridLayout.tsx | 4 +-
web/src/views/live/LiveCameraView.tsx | 62 +++++--
web/src/views/live/LiveDashboardView.tsx | 4 +-
web/src/views/recording/RecordingView.tsx | 4 +-
web/src/views/settings/AuthenticationView.tsx | 8 +-
web/src/views/settings/CameraSettingsView.tsx | 170 ++++++++++--------
web/src/views/settings/MotionTunerView.tsx | 18 +-
.../settings/NotificationsSettingsView.tsx | 6 +-
web/src/views/settings/ObjectSettingsView.tsx | 2 +-
web/src/views/settings/SearchSettingsView.tsx | 38 ++--
43 files changed, 348 insertions(+), 217 deletions(-)
diff --git a/web/public/locales/en/views/live.json b/web/public/locales/en/views/live.json
index e1ebaa159..b82dc17c2 100644
--- a/web/public/locales/en/views/live.json
+++ b/web/public/locales/en/views/live.json
@@ -38,6 +38,10 @@
}
}
},
+ "camera": {
+ "enable": "Enable Camera",
+ "disable": "Disable Camera"
+ },
"detect": {
"enable": "Enable Detect",
"disable": "Disable Detect"
diff --git a/web/public/locales/zh-CN/common.json b/web/public/locales/zh-CN/common.json
index a143765e5..18cf5cc73 100644
--- a/web/public/locales/zh-CN/common.json
+++ b/web/public/locales/zh-CN/common.json
@@ -64,6 +64,7 @@
"info": "信息"
},
"menu": {
+ "system": "系统",
"systemMetrics": "系统信息",
"configuration": "配置",
"systemLogs": "系统日志",
diff --git a/web/public/locales/zh-CN/views/live.json b/web/public/locales/zh-CN/views/live.json
index 401e300e7..3499449f6 100644
--- a/web/public/locales/zh-CN/views/live.json
+++ b/web/public/locales/zh-CN/views/live.json
@@ -38,6 +38,10 @@
}
}
},
+ "camera": {
+ "enable": "开启摄像头",
+ "disable": "关闭摄像头"
+ },
"detect": {
"enable": "启用检测",
"disable": "关闭检测"
diff --git a/web/src/components/filter/CalendarFilterButton.tsx b/web/src/components/filter/CalendarFilterButton.tsx
index 0ef8207da..d04adf187 100644
--- a/web/src/components/filter/CalendarFilterButton.tsx
+++ b/web/src/components/filter/CalendarFilterButton.tsx
@@ -69,7 +69,7 @@ export default function CalendarFilterButton({
updateSelectedDay(undefined);
}}
>
- {t("button.reset")}
+ {t("button.reset", { ns: "common" })}
>
diff --git a/web/src/components/filter/CameraGroupSelector.tsx b/web/src/components/filter/CameraGroupSelector.tsx
index 630e6a1da..aff94680a 100644
--- a/web/src/components/filter/CameraGroupSelector.tsx
+++ b/web/src/components/filter/CameraGroupSelector.tsx
@@ -76,7 +76,7 @@ import { Switch } from "../ui/switch";
import { CameraStreamingDialog } from "../settings/CameraStreamingDialog";
import { DialogTrigger } from "@radix-ui/react-dialog";
import { useStreamingSettings } from "@/context/streaming-settings-provider";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type CameraGroupSelectorProps = {
className?: string;
@@ -165,7 +165,7 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
- {t("menu.live.allCameras")}
+ {t("menu.live.allCameras", { ns: "common" })}
@@ -536,15 +536,19 @@ export function CameraGroupRow({
{t("group.delete.confirm")}
- {t("group.delete.confirm.desc", { name: group[0] })}
+
+ group.delete.confirm.desc
+
- {t("button.cancel")}
+
+ {t("button.cancel", { ns: "common" })}
+
- {t("button.delete")}
+ {t("button.delete", { ns: "common" })}
@@ -562,13 +566,13 @@ export function CameraGroupRow({
aria-label="Edit group"
onClick={onEditGroup}
>
- {t("button.edit")}
+ {t("button.edit", { ns: "common" })}
setDeleteDialogOpen(true)}
>
- {t("button.delete")}
+ {t("button.delete", { ns: "common" })}
@@ -585,7 +589,9 @@ export function CameraGroupRow({
onClick={onEditGroup}
/>
- {t("button.edit")}
+
+ {t("button.edit", { ns: "common" })}
+
@@ -596,7 +602,9 @@ export function CameraGroupRow({
onClick={() => setDeleteDialogOpen(true)}
/>
- {t("button.delete")}
+
+ {t("button.delete", { ns: "common" })}
+
)}
@@ -925,7 +933,7 @@ export function CameraGroupEdit({
aria-label="Cancel"
onClick={onCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/filter/CamerasFilterButton.tsx b/web/src/components/filter/CamerasFilterButton.tsx
index a9b4a4f15..cfd01d6da 100644
--- a/web/src/components/filter/CamerasFilterButton.tsx
+++ b/web/src/components/filter/CamerasFilterButton.tsx
@@ -42,7 +42,7 @@ export function CamerasFilterButton({
}
if (!selectedCameras || selectedCameras.length == 0) {
- return t("menu.live.allCameras");
+ return t("menu.live.allCameras", { ns: "common" });
}
return `${selectedCameras.includes("birdseye") ? selectedCameras.length - 1 : selectedCameras.length} Camera${selectedCameras.length !== 1 ? "s" : ""}`;
@@ -236,7 +236,7 @@ export function CamerasFilterContent({
setOpen(false);
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common" })}
>
diff --git a/web/src/components/filter/ReviewFilterGroup.tsx b/web/src/components/filter/ReviewFilterGroup.tsx
index 85a236bcc..888f6da5c 100644
--- a/web/src/components/filter/ReviewFilterGroup.tsx
+++ b/web/src/components/filter/ReviewFilterGroup.tsx
@@ -577,10 +577,10 @@ export function GeneralFilterContent({
onClose();
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common" })}
>
diff --git a/web/src/components/filter/SearchFilterGroup.tsx b/web/src/components/filter/SearchFilterGroup.tsx
index fb410fe33..6fc9bfe07 100644
--- a/web/src/components/filter/SearchFilterGroup.tsx
+++ b/web/src/components/filter/SearchFilterGroup.tsx
@@ -391,7 +391,7 @@ export function GeneralFilterContent({
onClose();
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common" })}
>
@@ -567,7 +567,7 @@ export function SortTypeContent({
onClose();
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common" })}
>
diff --git a/web/src/components/filter/ZoneMaskFilter.tsx b/web/src/components/filter/ZoneMaskFilter.tsx
index 9d1d26d7f..ae87672f4 100644
--- a/web/src/components/filter/ZoneMaskFilter.tsx
+++ b/web/src/components/filter/ZoneMaskFilter.tsx
@@ -101,10 +101,10 @@ export function GeneralFilterContent({
>
{t(
"masksAndZones." +
- item.replace(/_([a-z])/g, (letter) =>
- letter.toUpperCase(),
- ) +
- "s",
+ item
+ .replace(/_([a-z])/g, (letter) => letter.toUpperCase())
+ .replace("_", "") +
+ "s.label",
{ ns: "views/settings" },
)}
diff --git a/web/src/components/input/SaveSearchDialog.tsx b/web/src/components/input/SaveSearchDialog.tsx
index ff53d615d..348f9e1c4 100644
--- a/web/src/components/input/SaveSearchDialog.tsx
+++ b/web/src/components/input/SaveSearchDialog.tsx
@@ -80,7 +80,7 @@ export function SaveSearchDialog({
)}
diff --git a/web/src/components/menu/GeneralSettings.tsx b/web/src/components/menu/GeneralSettings.tsx
index ef148d612..b2cb445d3 100644
--- a/web/src/components/menu/GeneralSettings.tsx
+++ b/web/src/components/menu/GeneralSettings.tsx
@@ -187,7 +187,7 @@ export default function GeneralSettings({ className }: GeneralSettingsProps) {
>
- Logout
+ {t("menu.user.logout", { ns: "common" })}
diff --git a/web/src/components/menu/SearchResultActions.tsx b/web/src/components/menu/SearchResultActions.tsx
index b8e5c6e58..2f45ab698 100644
--- a/web/src/components/menu/SearchResultActions.tsx
+++ b/web/src/components/menu/SearchResultActions.tsx
@@ -40,7 +40,7 @@ import {
} from "@/components/ui/tooltip";
import useSWR from "swr";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type SearchResultActionsProps = {
searchResult: SearchResult;
@@ -154,7 +154,7 @@ export default function SearchResultActions({
onClick={() => setDeleteDialogOpen(true)}
>
- {t("button.delete")}
+ {t("button.delete", { ns: "common" })}
>
);
@@ -170,15 +170,17 @@ export default function SearchResultActions({
{t("dialog.confirmDelete")}
- {t("dialog.confirmDelete.desc")}
+ dialog.confirmDelete.desc
- {t("button.cancel")}
+
+ {t("button.cancel", { ns: "common" })}
+
- {t("button.delete")}
+ {t("button.delete", { ns: "common" })}
diff --git a/web/src/components/navigation/NavItem.tsx b/web/src/components/navigation/NavItem.tsx
index 2b425d678..a662b0a28 100644
--- a/web/src/components/navigation/NavItem.tsx
+++ b/web/src/components/navigation/NavItem.tsx
@@ -61,7 +61,7 @@ export default function NavItem({
{content}
- {t("{item.title}")}
+ {t(item.title)}
diff --git a/web/src/components/overlay/CameraInfoDialog.tsx b/web/src/components/overlay/CameraInfoDialog.tsx
index 8f11bf179..9360fd6de 100644
--- a/web/src/components/overlay/CameraInfoDialog.tsx
+++ b/web/src/components/overlay/CameraInfoDialog.tsx
@@ -15,7 +15,7 @@ import { useEffect, useState } from "react";
import axios from "axios";
import { toast } from "sonner";
import { Toaster } from "../ui/sonner";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type CameraInfoDialogProps = {
camera: CameraConfig;
@@ -80,7 +80,7 @@ export default function CameraInfoDialog({
- {t("cameras.info.streamDataFromFFPROBE")}
+ cameras.info.streamDataFromFFPROBE
@@ -184,7 +184,7 @@ export default function CameraInfoDialog({
aria-label="Copy"
onClick={() => onCopyFfprobe()}
>
- {t("button.copy")}
+ {t("button.copy", { ns: "common" })}
diff --git a/web/src/components/overlay/CreateUserDialog.tsx b/web/src/components/overlay/CreateUserDialog.tsx
index 0a22378d8..c72772f40 100644
--- a/web/src/components/overlay/CreateUserDialog.tsx
+++ b/web/src/components/overlay/CreateUserDialog.tsx
@@ -211,7 +211,7 @@ export default function CreateUserDialog({
render={({ field }) => (
- {t("role.title")}
+ {t("role.title", { ns: "common" })}
- {t("role.desc")}
+ {t("role.desc", { ns: "common" })}
@@ -261,7 +261,7 @@ export default function CreateUserDialog({
onClick={handleCancel}
type="button"
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
) : (
- t("button.save")
+ t("button.save", { ns: "common" })
)}
diff --git a/web/src/components/overlay/DeleteUserDialog.tsx b/web/src/components/overlay/DeleteUserDialog.tsx
index d24fcd5b1..4e14e0d74 100644
--- a/web/src/components/overlay/DeleteUserDialog.tsx
+++ b/web/src/components/overlay/DeleteUserDialog.tsx
@@ -48,7 +48,7 @@ export default function DeleteUserDialog({
onClick={onCancel}
type="button"
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/overlay/ExportDialog.tsx b/web/src/components/overlay/ExportDialog.tsx
index ac4045326..f28efb22e 100644
--- a/web/src/components/overlay/ExportDialog.tsx
+++ b/web/src/components/overlay/ExportDialog.tsx
@@ -321,7 +321,7 @@ export function ExportContent({
className={`cursor-pointer p-2 text-center ${isDesktop ? "" : "w-full"}`}
onClick={onCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/overlay/RoleChangeDialog.tsx b/web/src/components/overlay/RoleChangeDialog.tsx
index 265971e3d..3256cb83e 100644
--- a/web/src/components/overlay/RoleChangeDialog.tsx
+++ b/web/src/components/overlay/RoleChangeDialog.tsx
@@ -1,4 +1,4 @@
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
import { Button } from "../ui/button";
import {
Dialog,
@@ -52,7 +52,7 @@ export default function RoleChangeDialog({
- {t("users.dialog.changeRole.roleInfo")}
+ users.dialog.changeRole.roleInfo
diff --git a/web/src/components/overlay/SaveExportOverlay.tsx b/web/src/components/overlay/SaveExportOverlay.tsx
index 7cc0d7073..9c2a4f066 100644
--- a/web/src/components/overlay/SaveExportOverlay.tsx
+++ b/web/src/components/overlay/SaveExportOverlay.tsx
@@ -35,7 +35,7 @@ export default function SaveExportOverlay({
onClick={onCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx
index 051387525..3ffe4f331 100644
--- a/web/src/components/overlay/detail/SearchDetailDialog.tsx
+++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx
@@ -719,7 +719,7 @@ function ObjectDetailsTab({
aria-label="Save"
onClick={updateDescription}
>
- {t("button.save")}
+ {t("button.save", { ns: "common" })}
)}
- {t("button.download")}
+
+ {t("button.download", { ns: "common" })}
+
diff --git a/web/src/components/overlay/dialog/RestartDialog.tsx b/web/src/components/overlay/dialog/RestartDialog.tsx
index f3ee2f29e..4a0f122ba 100644
--- a/web/src/components/overlay/dialog/RestartDialog.tsx
+++ b/web/src/components/overlay/dialog/RestartDialog.tsx
@@ -84,7 +84,9 @@ export default function RestartDialog({
{t("restart.title")}
- {t("button.cancel")}
+
+ {t("button.cancel", { ns: "common" })}
+
{t("restart.button")}
diff --git a/web/src/components/overlay/dialog/SearchFilterDialog.tsx b/web/src/components/overlay/dialog/SearchFilterDialog.tsx
index 3908c735a..6b79df24d 100644
--- a/web/src/components/overlay/dialog/SearchFilterDialog.tsx
+++ b/web/src/components/overlay/dialog/SearchFilterDialog.tsx
@@ -33,7 +33,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type SearchFilterDialogProps = {
config?: FrigateConfig;
@@ -176,7 +176,7 @@ export default function SearchFilterDialog({
setOpen(false);
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common" })}
@@ -691,14 +691,14 @@ export function SnapshotClipFilterContent({
aria-label="Yes"
className="data-[state=on]:bg-selected data-[state=on]:text-white data-[state=on]:hover:bg-selected data-[state=on]:hover:text-white"
>
- {t("button.yes")}
+ {t("button.yes", { ns: "common" })}
- {t("button.no")}
+ {t("button.no", { ns: "common" })}
@@ -732,7 +732,9 @@ export function SnapshotClipFilterContent({
side="left"
sideOffset={5}
>
- {t("features.submittedToFrigatePlus.tips")}
+
+ features.submittedToFrigatePlus.tips
+
)}
@@ -767,14 +769,14 @@ export function SnapshotClipFilterContent({
aria-label="Yes"
className="data-[state=on]:bg-selected data-[state=on]:text-white data-[state=on]:hover:bg-selected data-[state=on]:hover:text-white"
>
- {t("button.yes")}
+ {t("button.yes", { ns: "common" })}
- {t("button.no")}
+ {t("button.no", { ns: "common" })}
@@ -822,14 +824,14 @@ export function SnapshotClipFilterContent({
aria-label="Yes"
className="data-[state=on]:bg-selected data-[state=on]:text-white data-[state=on]:hover:bg-selected data-[state=on]:hover:text-white"
>
- {t("button.yes")}
+ {t("button.yes", { ns: "common" })}
- {t("button.no")}
+ {t("button.no", { ns: "common" })}
diff --git a/web/src/components/overlay/dialog/TextEntryDialog.tsx b/web/src/components/overlay/dialog/TextEntryDialog.tsx
index fcf74d539..a25c023ea 100644
--- a/web/src/components/overlay/dialog/TextEntryDialog.tsx
+++ b/web/src/components/overlay/dialog/TextEntryDialog.tsx
@@ -91,10 +91,10 @@ export default function TextEntryDialog({
/>
diff --git a/web/src/components/settings/CameraStreamingDialog.tsx b/web/src/components/settings/CameraStreamingDialog.tsx
index 667728782..196f5ab14 100644
--- a/web/src/components/settings/CameraStreamingDialog.tsx
+++ b/web/src/components/settings/CameraStreamingDialog.tsx
@@ -31,7 +31,7 @@ import useSWR from "swr";
import { LuCheck, LuExternalLink, LuInfo, LuX } from "react-icons/lu";
import { Link } from "react-router-dom";
import { LiveStreamMetadata } from "@/types/live";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type CameraStreamingDialogProps = {
camera: string;
@@ -173,7 +173,9 @@ export function CameraStreamingDialog({
cameraName: camera.replaceAll("_", " "),
})}
- {t("group.camera.setting.desc")}
+
+ group.camera.setting.desc
+
{!isRestreamed && (
@@ -190,7 +192,9 @@ export function CameraStreamingDialog({
- {t("button.info")}
+
+ {t("button.info", { ns: "common" })}
+
@@ -247,7 +251,9 @@ export function CameraStreamingDialog({
- {t("button.info")}
+
+ {t("button.info", { ns: "common" })}
+
@@ -355,7 +361,7 @@ export function CameraStreamingDialog({
aria-label="Cancel"
onClick={handleCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
) : (
- t("button.save")
+ t("button.save", { ns: "common" })
)}
diff --git a/web/src/components/settings/MotionMaskEditPane.tsx b/web/src/components/settings/MotionMaskEditPane.tsx
index 085c2377d..586ae4ce7 100644
--- a/web/src/components/settings/MotionMaskEditPane.tsx
+++ b/web/src/components/settings/MotionMaskEditPane.tsx
@@ -22,7 +22,7 @@ import { Toaster } from "../ui/sonner";
import ActivityIndicator from "../indicators/activity-indicator";
import { Link } from "react-router-dom";
import { LuExternalLink } from "react-icons/lu";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type MotionMaskEditPaneProps = {
polygons?: Polygon[];
@@ -232,7 +232,9 @@ export default function MotionMaskEditPane({
: t("masksAndZones.motionMasks.add")}
-
{t("masksAndZones.motionMasks.context")}
+
+ masksAndZones.motionMasks.context
+
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
) : (
- t("button.save")
+ t("button.save", { ns: "common" })
)}
diff --git a/web/src/components/settings/ObjectMaskEditPane.tsx b/web/src/components/settings/ObjectMaskEditPane.tsx
index 954683f78..aa4f1b63a 100644
--- a/web/src/components/settings/ObjectMaskEditPane.tsx
+++ b/web/src/components/settings/ObjectMaskEditPane.tsx
@@ -365,7 +365,7 @@ export default function ObjectMaskEditPane({
aria-label="Cancel"
onClick={onCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/settings/PolygonItem.tsx b/web/src/components/settings/PolygonItem.tsx
index 3efd607c7..57dafab95 100644
--- a/web/src/components/settings/PolygonItem.tsx
+++ b/web/src/components/settings/PolygonItem.tsx
@@ -319,7 +319,9 @@ export default function PolygonItem({
}}
/>
- {t("button.edit")}
+
+ {t("button.edit", { ns: "common" })}
+
@@ -332,7 +334,9 @@ export default function PolygonItem({
onClick={() => handleCopyCoordinates(index)}
/>
- {t("button.copyCoordinates")}
+
+ {t("button.copyCoordinates", { ns: "common" })}
+
@@ -346,7 +350,9 @@ export default function PolygonItem({
onClick={() => !isLoading && setDeleteDialogOpen(true)}
/>
- {t("button.delete")}
+
+ {t("button.delete", { ns: "common" })}
+
)}
diff --git a/web/src/components/settings/ZoneEditPane.tsx b/web/src/components/settings/ZoneEditPane.tsx
index eec4b0e0a..d9988b161 100644
--- a/web/src/components/settings/ZoneEditPane.tsx
+++ b/web/src/components/settings/ZoneEditPane.tsx
@@ -29,7 +29,7 @@ import { toast } from "sonner";
import { flattenPoints, interpolatePoints } from "@/utils/canvasUtil";
import ActivityIndicator from "../indicators/activity-indicator";
import { getAttributeLabels } from "@/utils/iconUtil";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type ZoneEditPaneProps = {
polygons?: Polygon[];
@@ -558,7 +558,9 @@ export default function ZoneEditPane({
/>
- {t("masksAndZones.zones.inertia.desc")}
+
+ masksAndZones.zones.inertia.desc
+
@@ -579,7 +581,9 @@ export default function ZoneEditPane({
/>
- {t("masksAndZones.zones.loiteringTime.desc")}
+
+ masksAndZones.zones.loiteringTime.desc
+
@@ -808,7 +812,7 @@ export default function ZoneEditPane({
aria-label="Cancel"
onClick={onCancel}
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/components/ui/calendar-range.tsx b/web/src/components/ui/calendar-range.tsx
index 8d52cf7ca..0c866eb4b 100644
--- a/web/src/components/ui/calendar-range.tsx
+++ b/web/src/components/ui/calendar-range.tsx
@@ -431,7 +431,7 @@ export function DateRangePicker({
}
}}
>
- {t("button.apply")}
+ {t("button.apply", { ns: "common"})}
diff --git a/web/src/pages/Exports.tsx b/web/src/pages/Exports.tsx
index e8d34b420..a4f1f97e2 100644
--- a/web/src/pages/Exports.tsx
+++ b/web/src/pages/Exports.tsx
@@ -125,14 +125,16 @@ function Exports() {
- {t("button.cancel")}
+
+ {t("button.cancel", { ns: "common" })}
+
diff --git a/web/src/views/events/EventView.tsx b/web/src/views/events/EventView.tsx
index c60cb4159..d7ef32646 100644
--- a/web/src/views/events/EventView.tsx
+++ b/web/src/views/events/EventView.tsx
@@ -96,7 +96,7 @@ export default function EventView({
pullLatestData,
updateFilter,
}: EventViewProps) {
- const { t } = useTranslation(["views/event"]);
+ const { t } = useTranslation(["views/events"]);
const { data: config } = useSWR("config");
const contentRef = useRef(null);
@@ -472,7 +472,7 @@ function DetectionReview({
setSelectedReviews,
pullLatestData,
}: DetectionReviewProps) {
- const { t } = useTranslation(["views/event"]);
+ const { t } = useTranslation(["views/events"]);
const reviewTimelineRef = useRef(null);
@@ -870,7 +870,7 @@ function MotionReview({
motionOnly = false,
onOpenRecording,
}: MotionReviewProps) {
- const { t } = useTranslation(["views/event"]);
+ const { t } = useTranslation(["views/events"]);
const segmentDuration = 30;
const { data: config } = useSWR("config");
diff --git a/web/src/views/live/DraggableGridLayout.tsx b/web/src/views/live/DraggableGridLayout.tsx
index e0f4643e8..6f3a16df5 100644
--- a/web/src/views/live/DraggableGridLayout.tsx
+++ b/web/src/views/live/DraggableGridLayout.tsx
@@ -696,8 +696,8 @@ export default function DraggableGridLayout({
{fullscreen
- ? t("button.exitFullscreen")
- : t("button.fullscreen")}
+ ? t("button.exitFullscreen", { ns: "common" })
+ : t("button.fullscreen", { ns: "common" })}
>
diff --git a/web/src/views/live/LiveCameraView.tsx b/web/src/views/live/LiveCameraView.tsx
index eec58fc27..5ea70ad42 100644
--- a/web/src/views/live/LiveCameraView.tsx
+++ b/web/src/views/live/LiveCameraView.tsx
@@ -436,7 +436,9 @@ export default function LiveCameraView({
>
{isDesktop && (
- {t("button.back")}
+
+ {t("button.back", { ns: "common" })}
+
)}
@@ -479,7 +483,7 @@ export default function LiveCameraView({
{isDesktop && (
- {t("button.back")}
+ {t("button.back", { ns: "common" })}
)}
@@ -491,7 +495,9 @@ export default function LiveCameraView({
Icon={fullscreen ? FaCompress : FaExpand}
isActive={fullscreen}
title={
- fullscreen ? t("button.close") : t("button.fullscreen")
+ fullscreen
+ ? t("button.close", { ns: "common" })
+ : t("button.fullscreen", { ns: "common" })
}
onClick={toggleFullscreen}
/>
@@ -502,7 +508,11 @@ export default function LiveCameraView({
variant={fullscreen ? "overlay" : "primary"}
Icon={LuPictureInPicture}
isActive={pip}
- title={pip ? t("button.close") : t("button.pictureInPicture")}
+ title={
+ pip
+ ? t("button.close", { ns: "common" })
+ : t("button.pictureInPicture", { ns: "common" })
+ }
onClick={() => {
if (!pip) {
setPip(true);
@@ -1101,7 +1111,9 @@ function FrigateCameraFeatures({
variant={fullscreen ? "overlay" : "primary"}
Icon={enabledState == "ON" ? LuPower : LuPowerOff}
isActive={enabledState == "ON"}
- title={`${enabledState == "ON" ? "Disable" : "Enable"} Camera`}
+ title={
+ enabledState == "ON" ? t("camera.disable") : t("camera.enable")
+ }
onClick={() => sendEnabled(enabledState == "ON" ? "OFF" : "ON")}
disabled={false}
/>
@@ -1110,7 +1122,9 @@ function FrigateCameraFeatures({
variant={fullscreen ? "overlay" : "primary"}
Icon={detectState == "ON" ? MdPersonSearch : MdPersonOff}
isActive={detectState == "ON"}
- title={`${detectState == "ON" ? "Disable" : "Enable"} Detect`}
+ title={
+ detectState == "ON" ? t("detect.disable") : t("detect.enable")
+ }
onClick={() => sendDetect(detectState == "ON" ? "OFF" : "ON")}
disabled={!cameraEnabled}
/>
@@ -1119,7 +1133,11 @@ function FrigateCameraFeatures({
variant={fullscreen ? "overlay" : "primary"}
Icon={recordState == "ON" ? LuVideo : LuVideoOff}
isActive={recordState == "ON"}
- title={`${recordState == "ON" ? "Disable" : "Enable"} Recording`}
+ title={
+ recordState == "ON"
+ ? t("recording.disable")
+ : t("recording.enable")
+ }
onClick={() => sendRecord(recordState == "ON" ? "OFF" : "ON")}
disabled={!cameraEnabled}
/>
@@ -1128,7 +1146,11 @@ function FrigateCameraFeatures({
variant={fullscreen ? "overlay" : "primary"}
Icon={snapshotState == "ON" ? MdPhotoCamera : MdNoPhotography}
isActive={snapshotState == "ON"}
- title={`${snapshotState == "ON" ? "Disable" : "Enable"} Snapshots`}
+ title={
+ snapshotState == "ON"
+ ? t("snapshots.disable")
+ : t("snapshots.enable")
+ }
onClick={() => sendSnapshot(snapshotState == "ON" ? "OFF" : "ON")}
disabled={!cameraEnabled}
/>
@@ -1138,7 +1160,11 @@ function FrigateCameraFeatures({
variant={fullscreen ? "overlay" : "primary"}
Icon={audioState == "ON" ? LuEar : LuEarOff}
isActive={audioState == "ON"}
- title={`${audioState == "ON" ? "Disable" : "Enable"} Audio Detect`}
+ title={
+ audioState == "ON"
+ ? t("audioDetect.disable")
+ : t("audioDetect.enable")
+ }
onClick={() => sendAudio(audioState == "ON" ? "OFF" : "ON")}
disabled={!cameraEnabled}
/>
@@ -1151,7 +1177,11 @@ function FrigateCameraFeatures({
autotrackingState == "ON" ? TbViewfinder : TbViewfinderOff
}
isActive={autotrackingState == "ON"}
- title={`${autotrackingState == "ON" ? "Disable" : "Enable"} Autotracking`}
+ title={
+ autotrackingState == "ON"
+ ? t("autotracking.disable")
+ : t("autotracking.enable")
+ }
onClick={() =>
sendAutotracking(autotrackingState == "ON" ? "OFF" : "ON")
}
@@ -1189,11 +1219,13 @@ function FrigateCameraFeatures({
{!isRestreamed && (
-
+
- {t("streaming.restreaming.disabled", {
+ {t("streaming.restreaming.NotEnabled", {
ns: "components/dialog",
})}
@@ -1398,7 +1430,9 @@ function FrigateCameraFeatures({
className="mx-0 cursor-pointer text-primary"
htmlFor="showstats"
>
- {t("streaming.showStats", { ns: "components/dialog" })}
+ {t("streaming.showStats.label", {
+ ns: "components/dialog",
+ })}
{fullscreen
- ? t("button.exitFullscreen")
- : t("button.fullscreen")}
+ ? t("button.exitFullscreen", { ns: "common" })
+ : t("button.fullscreen", { ns: "common" })}
diff --git a/web/src/views/recording/RecordingView.tsx b/web/src/views/recording/RecordingView.tsx
index ad87ebaa1..95a19bab2 100644
--- a/web/src/views/recording/RecordingView.tsx
+++ b/web/src/views/recording/RecordingView.tsx
@@ -401,7 +401,9 @@ export function RecordingView({
>
{isDesktop && (
-
{t("button.back")}
+
+ {t("button.back", { ns: "common" })}
+
)}
@@ -326,7 +328,7 @@ export default function AuthenticationView() {
>
- {t("button.delete")}
+ {t("button.delete", { ns: "common" })}
diff --git a/web/src/views/settings/CameraSettingsView.tsx b/web/src/views/settings/CameraSettingsView.tsx
index 203138965..4dd34590c 100644
--- a/web/src/views/settings/CameraSettingsView.tsx
+++ b/web/src/views/settings/CameraSettingsView.tsx
@@ -27,11 +27,11 @@ import { LuExternalLink } from "react-icons/lu";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
import { MdCircle } from "react-icons/md";
import { cn } from "@/lib/utils";
-
+import { Trans } from "react-i18next";
+import { t } from "i18next";
import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { useAlertsState, useDetectionsState, useEnabledState } from "@/api/ws";
-import { useTranslation } from "react-i18next";
type CameraSettingsViewProps = {
selectedCamera: string;
@@ -47,7 +47,6 @@ export default function CameraSettingsView({
selectedCamera,
setUnsavedChanges,
}: CameraSettingsViewProps) {
- const { t } = useTranslation(["views/settings"]);
const { data: config, mutate: updateConfig } =
useSWR
("config");
@@ -82,7 +81,7 @@ export default function CameraSettingsView({
.map((label) => t(label, { ns: "objects" }))
.join(", ")
: "";
- }, [cameraConfig, t]);
+ }, [cameraConfig]);
const detectionsLabels = useMemo(() => {
return cameraConfig?.review.detections.labels
@@ -90,7 +89,7 @@ export default function CameraSettingsView({
.map((label) => t(label, { ns: "objects" }))
.join(", ")
: "";
- }, [cameraConfig, t]);
+ }, [cameraConfig]);
// form
@@ -191,7 +190,7 @@ export default function CameraSettingsView({
setIsLoading(false);
});
},
- [updateConfig, setIsLoading, selectedCamera, cameraConfig, t],
+ [updateConfig, setIsLoading, selectedCamera, cameraConfig],
);
const onCancel = useCallback(() => {
@@ -260,13 +259,13 @@ export default function CameraSettingsView({
- {t("camera.title")}
+ camera.title
- {t("camera.streams.title")}
+ camera.streams.title
@@ -279,16 +278,18 @@ export default function CameraSettingsView({
}}
/>
-
+
- {t("camera.streams.desc")}
+ camera.streams.desc
- {t("camera.review.title")}
+ camera.review.title
@@ -303,7 +304,7 @@ export default function CameraSettingsView({
/>
@@ -319,12 +320,12 @@ export default function CameraSettingsView({
/>
- {t("camera.review.desc")}
+ camera.review.desc
@@ -332,12 +333,16 @@ export default function CameraSettingsView({
- {t("camera.reviewClassification.title")}
+ camera.reviewClassification.title
-
{t("camera.reviewClassification.desc")}
+
+
+ camera.reviewClassification.desc
+
+
- {t("camera.reviewClassification.readTheDocumentation")}{" "}
+
+ camera.reviewClassification.readTheDocumentation
+ {" "}
@@ -374,13 +381,15 @@ export default function CameraSettingsView({
<>
- {t("camera.review.alerts")}
+
+ camera.review.alerts
+
- {t(
- "camera.reviewClassification.selectAlertsZones",
- )}
+
+ camera.reviewClassification.selectAlertsZones
+
@@ -429,7 +438,9 @@ export default function CameraSettingsView({
>
) : (
- {t("camera.reviewClassification.noDefinedZones")}
+
+ camera.reviewClassification.noDefinedZones
+
)}
@@ -450,6 +461,7 @@ export default function CameraSettingsView({
cameraName: capitalizeFirstLetter(
cameraConfig?.name ?? "",
).replaceAll("_", " "),
+ ns: "views/settings",
},
)
: t("camera.reviewClassification.objectAlertsTips", {
@@ -457,6 +469,7 @@ export default function CameraSettingsView({
cameraName: capitalizeFirstLetter(
cameraConfig?.name ?? "",
).replaceAll("_", " "),
+ ns: "views/settings",
})}
@@ -472,14 +485,16 @@ export default function CameraSettingsView({
<>
- {t("camera.review.detections")}
+
+ camera.review.detections
+
{selectDetections && (
- {t(
- "camera.reviewClassification.selectDetectionsZones",
- )}
+
+ camera.reviewClassification.selectDetectionsZones
+
)}
@@ -542,9 +557,9 @@ export default function CameraSettingsView({
htmlFor="select-detections"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
- {t(
- "camera.reviewClassification.limitDetections",
- )}
+
+ camera.reviewClassification.limitDetections
+
@@ -553,51 +568,58 @@ export default function CameraSettingsView({
{watchedDetectionsZones &&
- watchedDetectionsZones.length > 0
- ? !selectDetections
- ? t(
- "camera.reviewClassification.zoneObjectDetectionsTips",
- {
- detectionsLabels,
- zone: watchedDetectionsZones
- .map((zone) =>
- capitalizeFirstLetter(zone).replaceAll(
- "_",
- " ",
- ),
- )
- .join(", "),
- cameraName: capitalizeFirstLetter(
- cameraConfig?.name ?? "",
- ).replaceAll("_", " "),
- },
- )
- : t(
- "camera.reviewClassification.zoneObjectDetectionsTips.notSelectDetections",
- {
- detectionsLabels,
- zone: watchedDetectionsZones
- .map((zone) =>
- capitalizeFirstLetter(zone).replaceAll(
- "_",
- " ",
- ),
- )
- .join(", "),
- cameraName: capitalizeFirstLetter(
- cameraConfig?.name ?? "",
- ).replaceAll("_", " "),
- },
- )
- : t(
- "camera.reviewClassification.objectDetectionsTips",
- {
+ watchedDetectionsZones.length > 0 ? (
+ !selectDetections ? (
+
+ capitalizeFirstLetter(zone).replaceAll(
+ "_",
+ " ",
+ ),
+ )
+ .join(", "),
cameraName: capitalizeFirstLetter(
cameraConfig?.name ?? "",
).replaceAll("_", " "),
- },
- )}
+ }}
+ ns="views/settings"
+ >
+ ) : (
+
+ capitalizeFirstLetter(zone).replaceAll(
+ "_",
+ " ",
+ ),
+ )
+ .join(", "),
+ cameraName: capitalizeFirstLetter(
+ cameraConfig?.name ?? "",
+ ).replaceAll("_", " "),
+ }}
+ ns="views/settings"
+ />
+ )
+ ) : (
+
+ )}
)}
@@ -612,7 +634,7 @@ export default function CameraSettingsView({
onClick={onCancel}
type="button"
>
- {t("button.cancel")}
+ button.cancel
diff --git a/web/src/views/settings/MotionTunerView.tsx b/web/src/views/settings/MotionTunerView.tsx
index 6bf1406a4..3ce691bb6 100644
--- a/web/src/views/settings/MotionTunerView.tsx
+++ b/web/src/views/settings/MotionTunerView.tsx
@@ -21,7 +21,7 @@ import { Separator } from "@/components/ui/separator";
import { Link } from "react-router-dom";
import { LuExternalLink } from "react-icons/lu";
import { StatusBarMessagesContext } from "@/context/statusbar-provider";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type MotionTunerViewProps = {
selectedCamera: string;
@@ -236,7 +236,11 @@ export default function MotionTunerView({
{t("motionDetectionTuner.contourArea")}
-
{t("motionDetectionTuner.contourArea.desc")}
+
+
+ motionDetectionTuner.contourArea.desc
+
+
@@ -264,7 +268,9 @@ export default function MotionTunerView({
{t("motionDetectionTuner.improveContrast")}
- {t("motionDetectionTuner.improveContrast.desc")}
+
+ motionDetectionTuner.improveContrast.desc
+
- {t("button.reset")}
+ {t("button.reset", { ns: "common" })}
diff --git a/web/src/views/settings/NotificationsSettingsView.tsx b/web/src/views/settings/NotificationsSettingsView.tsx
index bd4be2b2b..dd3490624 100644
--- a/web/src/views/settings/NotificationsSettingsView.tsx
+++ b/web/src/views/settings/NotificationsSettingsView.tsx
@@ -478,7 +478,7 @@ export default function NotificationView({
onClick={onCancel}
type="button"
>
- {t("button.cancel")}
+ {t("button.cancel", { ns: "common" })}
diff --git a/web/src/views/settings/ObjectSettingsView.tsx b/web/src/views/settings/ObjectSettingsView.tsx
index 6e8c7a51d..5f43e7133 100644
--- a/web/src/views/settings/ObjectSettingsView.tsx
+++ b/web/src/views/settings/ObjectSettingsView.tsx
@@ -250,7 +250,7 @@ export default function ObjectSettingsView({
- {t("button.info")}
+ {t("button.info", { ns: "common" })}
diff --git a/web/src/views/settings/SearchSettingsView.tsx b/web/src/views/settings/SearchSettingsView.tsx
index 719558b82..79ac7e3f4 100644
--- a/web/src/views/settings/SearchSettingsView.tsx
+++ b/web/src/views/settings/SearchSettingsView.tsx
@@ -20,7 +20,7 @@ import {
SelectItem,
SelectTrigger,
} from "@/components/ui/select";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
type ExploreSettingsViewProps = {
setUnsavedChanges: React.Dispatch>;
@@ -172,7 +172,9 @@ export default function ExploreSettingsView({
-
{t("explore.semanticSearch.desc")}
+
+ explore.semanticSearch.desc
+
-
+
@@ -221,7 +225,9 @@ export default function ExploreSettingsView({
- {t("explore.semanticSearch.reindexOnStartup.desc")}
+
+ explore.semanticSearch.reindexOnStartup.desc
+
@@ -230,10 +236,22 @@ export default function ExploreSettingsView({
{t("explore.semanticSearch.modelSize.label")}
-
{t("explore.semanticSearch.modelSize.desc")}
+
+
+ explore.semanticSearch.modelSize.desc
+
+
- - {t("explore.semanticSearch.modelSize.small.desc")}
- - {t("explore.semanticSearch.modelSize.large.desc")}
+ -
+
+ explore.semanticSearch.modelSize.small.desc
+
+
+ -
+
+ explore.semanticSearch.modelSize.large.desc
+
+
@@ -271,7 +289,7 @@ export default function ExploreSettingsView({
) : (
- t("button.save")
+ t("button.save", { ns: "common" })
)}