From 5593495abdd2bc463c6ffa6cce21fa2414c92776 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 26 Jun 2025 09:25:47 -0500 Subject: [PATCH] Fixes (#18893) * i18n translated label fixes * Fix frame cache race bug Objects that were marked as false positives (that would later become true positives) would sometimes have their saved frame prematurely removed from the frame cache. --- frigate/camera/state.py | 2 +- web/src/components/filter/SearchFilterGroup.tsx | 4 +--- web/src/components/input/InputWithTags.tsx | 9 +++------ .../components/overlay/detail/ReviewDetailDialog.tsx | 7 ++----- .../components/overlay/detail/SearchDetailDialog.tsx | 11 +++++------ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/frigate/camera/state.py b/frigate/camera/state.py index 620873cba..06564bce2 100644 --- a/frigate/camera/state.py +++ b/frigate/camera/state.py @@ -426,7 +426,7 @@ class CameraState: current_thumb_frames = { obj.thumbnail_data["frame_time"] for obj in tracked_objects.values() - if not obj.false_positive and obj.thumbnail_data is not None + if obj.thumbnail_data is not None } current_best_frames = { obj.thumbnail_data["frame_time"] for obj in self.best_objects.values() diff --git a/web/src/components/filter/SearchFilterGroup.tsx b/web/src/components/filter/SearchFilterGroup.tsx index 4e1f98ebe..198f27b63 100644 --- a/web/src/components/filter/SearchFilterGroup.tsx +++ b/web/src/components/filter/SearchFilterGroup.tsx @@ -264,9 +264,7 @@ function GeneralFilterButton({ } if (selectedLabels.length == 1) { - return t(selectedLabels[0], { - ns: "objects", - }); + return getTranslatedLabel(selectedLabels[0]); } return t("labels.count", { diff --git a/web/src/components/input/InputWithTags.tsx b/web/src/components/input/InputWithTags.tsx index ab31e1808..0e29c3015 100644 --- a/web/src/components/input/InputWithTags.tsx +++ b/web/src/components/input/InputWithTags.tsx @@ -52,6 +52,7 @@ import useSWR from "swr"; import { FrigateConfig } from "@/types/frigateConfig"; import { MdImageSearch } from "react-icons/md"; import { useTranslation } from "react-i18next"; +import { getTranslatedLabel } from "@/utils/i18n"; type InputWithTagsProps = { inputFocused: boolean; @@ -419,9 +420,7 @@ export default function InputWithTags({ ? t("button.yes", { ns: "common" }) : t("button.no", { ns: "common" }); } else if (filterType === "labels") { - return t(filterValues as string, { - ns: "objects", - }); + return getTranslatedLabel(filterValues as string); } else if (filterType === "search_type") { return t("filter.searchType." + (filterValues as string)); } else { @@ -828,9 +827,7 @@ export default function InputWithTags({ > {t("filter.label." + filterType)}:{" "} {filterType === "labels" - ? t(value, { - ns: "objects", - }) + ? getTranslatedLabel(value) : value.replaceAll("_", " ")}