From cd7f7f7f93526053325058e8668d852958204762 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 26 Jun 2025 08:32:36 -0500 Subject: [PATCH] i18n translated label fixes --- 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 +++++------ 4 files changed, 11 insertions(+), 20 deletions(-) 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("_", " ")}