i18n translated label fixes

This commit is contained in:
Josh Hawkins 2025-06-26 08:32:36 -05:00
parent e0c1fea2ac
commit cd7f7f7f93
4 changed files with 11 additions and 20 deletions

View File

@ -264,9 +264,7 @@ function GeneralFilterButton({
} }
if (selectedLabels.length == 1) { if (selectedLabels.length == 1) {
return t(selectedLabels[0], { return getTranslatedLabel(selectedLabels[0]);
ns: "objects",
});
} }
return t("labels.count", { return t("labels.count", {

View File

@ -52,6 +52,7 @@ import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig"; import { FrigateConfig } from "@/types/frigateConfig";
import { MdImageSearch } from "react-icons/md"; import { MdImageSearch } from "react-icons/md";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { getTranslatedLabel } from "@/utils/i18n";
type InputWithTagsProps = { type InputWithTagsProps = {
inputFocused: boolean; inputFocused: boolean;
@ -419,9 +420,7 @@ export default function InputWithTags({
? t("button.yes", { ns: "common" }) ? t("button.yes", { ns: "common" })
: t("button.no", { ns: "common" }); : t("button.no", { ns: "common" });
} else if (filterType === "labels") { } else if (filterType === "labels") {
return t(filterValues as string, { return getTranslatedLabel(filterValues as string);
ns: "objects",
});
} else if (filterType === "search_type") { } else if (filterType === "search_type") {
return t("filter.searchType." + (filterValues as string)); return t("filter.searchType." + (filterValues as string));
} else { } else {
@ -828,9 +827,7 @@ export default function InputWithTags({
> >
{t("filter.label." + filterType)}:{" "} {t("filter.label." + filterType)}:{" "}
{filterType === "labels" {filterType === "labels"
? t(value, { ? getTranslatedLabel(value)
ns: "objects",
})
: value.replaceAll("_", " ")} : value.replaceAll("_", " ")}
<button <button
onClick={() => onClick={() =>

View File

@ -42,6 +42,7 @@ import { TooltipPortal } from "@radix-ui/react-tooltip";
import { LuSearch } from "react-icons/lu"; import { LuSearch } from "react-icons/lu";
import useKeyboardListener from "@/hooks/use-keyboard-listener"; import useKeyboardListener from "@/hooks/use-keyboard-listener";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { getTranslatedLabel } from "@/utils/i18n";
type ReviewDetailDialogProps = { type ReviewDetailDialogProps = {
review?: ReviewSegment; review?: ReviewSegment;
@ -328,11 +329,7 @@ export default function ReviewDetailDialog({
ns="views/explore" ns="views/explore"
values={{ values={{
objects: missingObjects objects: missingObjects
.map((x) => .map((x) => getTranslatedLabel(x))
t(x, {
ns: "objects",
}),
)
.join(", "), .join(", "),
}} }}
> >

View File

@ -77,6 +77,7 @@ import { Trans, useTranslation } from "react-i18next";
import { TbFaceId } from "react-icons/tb"; import { TbFaceId } from "react-icons/tb";
import { useIsAdmin } from "@/hooks/use-is-admin"; import { useIsAdmin } from "@/hooks/use-is-admin";
import FaceSelectionDialog from "../FaceSelectionDialog"; import FaceSelectionDialog from "../FaceSelectionDialog";
import { getTranslatedLabel } from "@/utils/i18n";
const SEARCH_TABS = [ const SEARCH_TABS = [
"details", "details",
@ -717,9 +718,7 @@ function ObjectDetailsTab({
<div className="text-sm text-primary/40">{t("details.label")}</div> <div className="text-sm text-primary/40">{t("details.label")}</div>
<div className="flex flex-row items-center gap-2 text-sm smart-capitalize"> <div className="flex flex-row items-center gap-2 text-sm smart-capitalize">
{getIconForLabel(search.label, "size-4 text-primary")} {getIconForLabel(search.label, "size-4 text-primary")}
{t(search.label, { {getTranslatedLabel(search.label)}
ns: "objects",
})}
{search.sub_label && ` (${search.sub_label})`} {search.sub_label && ` (${search.sub_label})`}
{isAdmin && search.end_time && ( {isAdmin && search.end_time && (
<Tooltip> <Tooltip>
@ -1167,9 +1166,9 @@ export function ObjectSnapshotTab({
ns="components/dialog" ns="components/dialog"
values={{ values={{
untranslatedLabel: search?.label, untranslatedLabel: search?.label,
translatedLabel: t(search?.label, { translatedLabel: getTranslatedLabel(
ns: "objects", search?.label,
}), ),
}} }}
> >
explore.plus.review.question.ask_full explore.plus.review.question.ask_full