Skip to content

Commit 5593495

Browse files
authored
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.
1 parent fd96cd5 commit 5593495

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

frigate/camera/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def update(
426426
current_thumb_frames = {
427427
obj.thumbnail_data["frame_time"]
428428
for obj in tracked_objects.values()
429-
if not obj.false_positive and obj.thumbnail_data is not None
429+
if obj.thumbnail_data is not None
430430
}
431431
current_best_frames = {
432432
obj.thumbnail_data["frame_time"] for obj in self.best_objects.values()

web/src/components/filter/SearchFilterGroup.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ function GeneralFilterButton({
264264
}
265265

266266
if (selectedLabels.length == 1) {
267-
return t(selectedLabels[0], {
268-
ns: "objects",
269-
});
267+
return getTranslatedLabel(selectedLabels[0]);
270268
}
271269

272270
return t("labels.count", {

web/src/components/input/InputWithTags.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import useSWR from "swr";
5252
import { FrigateConfig } from "@/types/frigateConfig";
5353
import { MdImageSearch } from "react-icons/md";
5454
import { useTranslation } from "react-i18next";
55+
import { getTranslatedLabel } from "@/utils/i18n";
5556

5657
type InputWithTagsProps = {
5758
inputFocused: boolean;
@@ -419,9 +420,7 @@ export default function InputWithTags({
419420
? t("button.yes", { ns: "common" })
420421
: t("button.no", { ns: "common" });
421422
} else if (filterType === "labels") {
422-
return t(filterValues as string, {
423-
ns: "objects",
424-
});
423+
return getTranslatedLabel(filterValues as string);
425424
} else if (filterType === "search_type") {
426425
return t("filter.searchType." + (filterValues as string));
427426
} else {
@@ -828,9 +827,7 @@ export default function InputWithTags({
828827
>
829828
{t("filter.label." + filterType)}:{" "}
830829
{filterType === "labels"
831-
? t(value, {
832-
ns: "objects",
833-
})
830+
? getTranslatedLabel(value)
834831
: value.replaceAll("_", " ")}
835832
<button
836833
onClick={() =>

web/src/components/overlay/detail/ReviewDetailDialog.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { TooltipPortal } from "@radix-ui/react-tooltip";
4242
import { LuSearch } from "react-icons/lu";
4343
import useKeyboardListener from "@/hooks/use-keyboard-listener";
4444
import { Trans, useTranslation } from "react-i18next";
45+
import { getTranslatedLabel } from "@/utils/i18n";
4546

4647
type ReviewDetailDialogProps = {
4748
review?: ReviewSegment;
@@ -328,11 +329,7 @@ export default function ReviewDetailDialog({
328329
ns="views/explore"
329330
values={{
330331
objects: missingObjects
331-
.map((x) =>
332-
t(x, {
333-
ns: "objects",
334-
}),
335-
)
332+
.map((x) => getTranslatedLabel(x))
336333
.join(", "),
337334
}}
338335
>

web/src/components/overlay/detail/SearchDetailDialog.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import { Trans, useTranslation } from "react-i18next";
7777
import { TbFaceId } from "react-icons/tb";
7878
import { useIsAdmin } from "@/hooks/use-is-admin";
7979
import FaceSelectionDialog from "../FaceSelectionDialog";
80+
import { getTranslatedLabel } from "@/utils/i18n";
8081

8182
const SEARCH_TABS = [
8283
"details",
@@ -717,9 +718,7 @@ function ObjectDetailsTab({
717718
<div className="text-sm text-primary/40">{t("details.label")}</div>
718719
<div className="flex flex-row items-center gap-2 text-sm smart-capitalize">
719720
{getIconForLabel(search.label, "size-4 text-primary")}
720-
{t(search.label, {
721-
ns: "objects",
722-
})}
721+
{getTranslatedLabel(search.label)}
723722
{search.sub_label && ` (${search.sub_label})`}
724723
{isAdmin && search.end_time && (
725724
<Tooltip>
@@ -1167,9 +1166,9 @@ export function ObjectSnapshotTab({
11671166
ns="components/dialog"
11681167
values={{
11691168
untranslatedLabel: search?.label,
1170-
translatedLabel: t(search?.label, {
1171-
ns: "objects",
1172-
}),
1169+
translatedLabel: getTranslatedLabel(
1170+
search?.label,
1171+
),
11731172
}}
11741173
>
11751174
explore.plus.review.question.ask_full

0 commit comments

Comments
 (0)