mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 04:57:42 +03:00
fix: some pages can't translation object label.
This commit is contained in:
parent
4abf945b71
commit
1c2bd5d419
@ -54,7 +54,12 @@
|
|||||||
},
|
},
|
||||||
"gone": "{{label}} left",
|
"gone": "{{label}} left",
|
||||||
"heard": "{{label}} heard",
|
"heard": "{{label}} heard",
|
||||||
"external": "{{label}} detected"
|
"external": "{{label}} detected",
|
||||||
|
"header": {
|
||||||
|
"zones": "Zones",
|
||||||
|
"ratio": "Ratio",
|
||||||
|
"area": "Area"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"annotationSettings": {
|
"annotationSettings": {
|
||||||
"title": "Annotation Settings",
|
"title": "Annotation Settings",
|
||||||
|
|||||||
@ -127,7 +127,9 @@ export default function SearchThumbnail({
|
|||||||
.filter(
|
.filter(
|
||||||
(item) => item !== undefined && !item.includes("-verified"),
|
(item) => item !== undefined && !item.includes("-verified"),
|
||||||
)
|
)
|
||||||
.map((text) => t(text, { ns: "objects" }))
|
.map((text) =>
|
||||||
|
t(text.replace(" ", "_").toLowerCase(), { ns: "objects" }),
|
||||||
|
)
|
||||||
.sort()
|
.sort()
|
||||||
.join(", ")
|
.join(", ")
|
||||||
.replaceAll("-verified", "")}
|
.replaceAll("-verified", "")}
|
||||||
|
|||||||
@ -248,7 +248,9 @@ function GeneralFilterButton({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selectedLabels.length == 1) {
|
if (selectedLabels.length == 1) {
|
||||||
return t(selectedLabels[0], { ns: "objects" });
|
return t(selectedLabels[0].replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return t("labels.count", {
|
return t("labels.count", {
|
||||||
@ -355,7 +357,7 @@ export function GeneralFilterContent({
|
|||||||
{allLabels.map((item) => (
|
{allLabels.map((item) => (
|
||||||
<FilterSwitch
|
<FilterSwitch
|
||||||
key={item}
|
key={item}
|
||||||
label={t(item, { ns: "objects" })}
|
label={t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
|
||||||
isChecked={currentLabels?.includes(item) ?? false}
|
isChecked={currentLabels?.includes(item) ?? false}
|
||||||
onCheckedChange={(isChecked) => {
|
onCheckedChange={(isChecked) => {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
|
|||||||
@ -419,7 +419,9 @@ 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, { ns: "objects" });
|
return t((filterValues as string).replace(" ", "_").toLowerCase(), {
|
||||||
|
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 {
|
||||||
@ -806,7 +808,11 @@ export default function InputWithTags({
|
|||||||
className="inline-flex items-center whitespace-nowrap rounded-full bg-green-100 px-2 py-0.5 text-sm capitalize text-green-800"
|
className="inline-flex items-center whitespace-nowrap rounded-full bg-green-100 px-2 py-0.5 text-sm capitalize text-green-800"
|
||||||
>
|
>
|
||||||
{t("filter.label." + filterType)}:{" "}
|
{t("filter.label." + filterType)}:{" "}
|
||||||
{value.replaceAll("_", " ")}
|
{filterType === "labels"
|
||||||
|
? t(value.replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
})
|
||||||
|
: value.replaceAll("_", " ")}
|
||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
removeFilter(filterType as FilterType, value)
|
removeFilter(filterType as FilterType, value)
|
||||||
|
|||||||
@ -200,9 +200,9 @@ export function AnnotationSettingsPane({
|
|||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormDescription>
|
<FormDescription>
|
||||||
{t(
|
<Trans ns="views/explore">
|
||||||
"objectLifecycle.annotationSettings.offset.millisecondsToOffset",
|
objectLifecycle.annotationSettings.offset.millisecondsToOffset
|
||||||
)}
|
</Trans>
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
{t("objectLifecycle.annotationSettings.offset.tips")}
|
{t("objectLifecycle.annotationSettings.offset.tips")}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -596,7 +596,9 @@ export default function ObjectLifecycle({
|
|||||||
<div className="text-md mr-2 w-1/3">
|
<div className="text-md mr-2 w-1/3">
|
||||||
<div className="flex flex-col items-end justify-start">
|
<div className="flex flex-col items-end justify-start">
|
||||||
<p className="mb-1.5 text-sm text-primary-variant">
|
<p className="mb-1.5 text-sm text-primary-variant">
|
||||||
Zones
|
{t(
|
||||||
|
"objectLifecycle.lifecycleItemDesc.header.zones",
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
{item.class_type === "entered_zone"
|
{item.class_type === "entered_zone"
|
||||||
? item.data.zones.map((zone, index) => (
|
? item.data.zones.map((zone, index) => (
|
||||||
@ -627,7 +629,9 @@ export default function ObjectLifecycle({
|
|||||||
<div className="text-md mr-2 w-1/3">
|
<div className="text-md mr-2 w-1/3">
|
||||||
<div className="flex flex-col items-end justify-start">
|
<div className="flex flex-col items-end justify-start">
|
||||||
<p className="mb-1.5 text-sm text-primary-variant">
|
<p className="mb-1.5 text-sm text-primary-variant">
|
||||||
Ratio
|
{t(
|
||||||
|
"objectLifecycle.lifecycleItemDesc.header.ratio",
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
{Array.isArray(item.data.box) &&
|
{Array.isArray(item.data.box) &&
|
||||||
item.data.box.length >= 4
|
item.data.box.length >= 4
|
||||||
@ -641,7 +645,7 @@ export default function ObjectLifecycle({
|
|||||||
<div className="text-md mr-2 w-1/3">
|
<div className="text-md mr-2 w-1/3">
|
||||||
<div className="flex flex-col items-end justify-start">
|
<div className="flex flex-col items-end justify-start">
|
||||||
<p className="mb-1.5 text-sm text-primary-variant">
|
<p className="mb-1.5 text-sm text-primary-variant">
|
||||||
Area
|
{t("objectLifecycle.lifecycleItemDesc.header.area")}
|
||||||
</p>
|
</p>
|
||||||
{Array.isArray(item.data.box) &&
|
{Array.isArray(item.data.box) &&
|
||||||
item.data.box.length >= 4 ? (
|
item.data.box.length >= 4 ? (
|
||||||
|
|||||||
@ -324,7 +324,11 @@ export default function ReviewDetailDialog({
|
|||||||
ns="views/explore"
|
ns="views/explore"
|
||||||
values={{
|
values={{
|
||||||
objects: missingObjects
|
objects: missingObjects
|
||||||
.map((x) => t(x, { ns: "objects" }))
|
.map((x) =>
|
||||||
|
t(x.replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
}),
|
||||||
|
)
|
||||||
.join(", "),
|
.join(", "),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -690,7 +690,9 @@ 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 capitalize">
|
<div className="flex flex-row items-center gap-2 text-sm capitalize">
|
||||||
{getIconForLabel(search.label, "size-4 text-primary")}
|
{getIconForLabel(search.label, "size-4 text-primary")}
|
||||||
{t(search.label, { ns: "objects" })}
|
{t(search.label.replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
})}
|
||||||
{search.sub_label && ` (${search.sub_label})`}
|
{search.sub_label && ` (${search.sub_label})`}
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
@ -951,7 +953,9 @@ function ObjectDetailsTab({
|
|||||||
description={
|
description={
|
||||||
search.label
|
search.label
|
||||||
? t("details.editSubLabel.desc", {
|
? t("details.editSubLabel.desc", {
|
||||||
label: t(search.label, { ns: "objects" }),
|
label: t(search.label.replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
: t("details.editSubLabel.descNoLabel")
|
: t("details.editSubLabel.descNoLabel")
|
||||||
}
|
}
|
||||||
@ -966,7 +970,9 @@ function ObjectDetailsTab({
|
|||||||
description={
|
description={
|
||||||
search.label
|
search.label
|
||||||
? t("details.editLPR.desc", {
|
? t("details.editLPR.desc", {
|
||||||
label: t(search.label, { ns: "objects" }),
|
label: t(search.label.replace(" ", "_").toLowerCase(), {
|
||||||
|
ns: "objects",
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
: t("details.editLPR.descNoLabel")
|
: t("details.editLPR.descNoLabel")
|
||||||
}
|
}
|
||||||
@ -1112,10 +1118,20 @@ export function ObjectSnapshotTab({
|
|||||||
>
|
>
|
||||||
{/^[aeiou]/i.test(search?.label || "")
|
{/^[aeiou]/i.test(search?.label || "")
|
||||||
? t("explore.plus.review.true.true_other", {
|
? t("explore.plus.review.true.true_other", {
|
||||||
label: search?.label,
|
label: t(
|
||||||
|
search?.label
|
||||||
|
.replace(" ", "_")
|
||||||
|
.toLowerCase(),
|
||||||
|
{ ns: "objects" },
|
||||||
|
),
|
||||||
})
|
})
|
||||||
: t("explore.plus.review.true.true_one", {
|
: t("explore.plus.review.true.true_one", {
|
||||||
label: search?.label,
|
label: t(
|
||||||
|
search?.label
|
||||||
|
.replace(" ", "_")
|
||||||
|
.toLowerCase(),
|
||||||
|
{ ns: "objects" },
|
||||||
|
),
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@ -1129,10 +1145,20 @@ export function ObjectSnapshotTab({
|
|||||||
>
|
>
|
||||||
{/^[aeiou]/i.test(search?.label || "")
|
{/^[aeiou]/i.test(search?.label || "")
|
||||||
? t("explore.plus.review.false.false_other", {
|
? t("explore.plus.review.false.false_other", {
|
||||||
label: search?.label,
|
label: t(
|
||||||
|
search?.label
|
||||||
|
.replace(" ", "_")
|
||||||
|
.toLowerCase(),
|
||||||
|
{ ns: "objects" },
|
||||||
|
),
|
||||||
})
|
})
|
||||||
: t("explore.plus.review.false.false_one", {
|
: t("explore.plus.review.false.false_one", {
|
||||||
label: search?.label,
|
label: t(
|
||||||
|
search?.label
|
||||||
|
.replace(" ", "_")
|
||||||
|
.toLowerCase(),
|
||||||
|
{ ns: "objects" },
|
||||||
|
),
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -448,7 +448,7 @@ export function ZoneObjectSelector({ camera }: ZoneObjectSelectorProps) {
|
|||||||
<SelectSeparator className="bg-secondary" />
|
<SelectSeparator className="bg-secondary" />
|
||||||
{allLabels.map((item) => (
|
{allLabels.map((item) => (
|
||||||
<SelectItem key={item} value={item}>
|
<SelectItem key={item} value={item}>
|
||||||
{t(item, { ns: "objects" })}
|
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectGroup>
|
</SelectGroup>
|
||||||
|
|||||||
@ -936,7 +936,7 @@ export function ZoneObjectSelector({
|
|||||||
className="w-full cursor-pointer capitalize text-primary"
|
className="w-full cursor-pointer capitalize text-primary"
|
||||||
htmlFor={item}
|
htmlFor={item}
|
||||||
>
|
>
|
||||||
{t(item, { ns: "objects" })}
|
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })}
|
||||||
</Label>
|
</Label>
|
||||||
<Switch
|
<Switch
|
||||||
key={item}
|
key={item}
|
||||||
|
|||||||
@ -5,11 +5,16 @@ export function getLifecycleItemDescription(
|
|||||||
lifecycleItem: ObjectLifecycleSequence,
|
lifecycleItem: ObjectLifecycleSequence,
|
||||||
) {
|
) {
|
||||||
// can't use useTranslation here
|
// can't use useTranslation here
|
||||||
const label = (
|
const label = t(
|
||||||
(Array.isArray(lifecycleItem.data.sub_label)
|
(
|
||||||
? lifecycleItem.data.sub_label[0]
|
(Array.isArray(lifecycleItem.data.sub_label)
|
||||||
: lifecycleItem.data.sub_label) || lifecycleItem.data.label
|
? lifecycleItem.data.sub_label[0]
|
||||||
).replaceAll("_", " ");
|
: lifecycleItem.data.sub_label) || lifecycleItem.data.label
|
||||||
|
)
|
||||||
|
.replace(" ", "_")
|
||||||
|
.toLowerCase(),
|
||||||
|
{ ns: "objects" },
|
||||||
|
);
|
||||||
|
|
||||||
switch (lifecycleItem.class_type) {
|
switch (lifecycleItem.class_type) {
|
||||||
case "visible":
|
case "visible":
|
||||||
|
|||||||
@ -152,7 +152,7 @@ function ThumbnailRow({
|
|||||||
return (
|
return (
|
||||||
<div className="rounded-lg bg-background_alt p-2 md:px-4">
|
<div className="rounded-lg bg-background_alt p-2 md:px-4">
|
||||||
<div className="flex flex-row items-center text-lg capitalize">
|
<div className="flex flex-row items-center text-lg capitalize">
|
||||||
{t(objectType, { ns: "objects" })}
|
{t(objectType.replace(" ", "_").toLowerCase(), { ns: "objects" })}
|
||||||
{searchResults && (
|
{searchResults && (
|
||||||
<span className="ml-3 text-sm text-secondary-foreground">
|
<span className="ml-3 text-sm text-secondary-foreground">
|
||||||
{t("trackedObjectsCount", {
|
{t("trackedObjectsCount", {
|
||||||
|
|||||||
@ -79,7 +79,9 @@ export default function CameraSettingsView({
|
|||||||
const alertsLabels = useMemo(() => {
|
const alertsLabels = useMemo(() => {
|
||||||
return cameraConfig?.review.alerts.labels
|
return cameraConfig?.review.alerts.labels
|
||||||
? cameraConfig.review.alerts.labels
|
? cameraConfig.review.alerts.labels
|
||||||
.map((label) => t(label, { ns: "objects" }))
|
.map((label) =>
|
||||||
|
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
|
||||||
|
)
|
||||||
.join(", ")
|
.join(", ")
|
||||||
: "";
|
: "";
|
||||||
}, [cameraConfig, t]);
|
}, [cameraConfig, t]);
|
||||||
@ -87,7 +89,9 @@ export default function CameraSettingsView({
|
|||||||
const detectionsLabels = useMemo(() => {
|
const detectionsLabels = useMemo(() => {
|
||||||
return cameraConfig?.review.detections.labels
|
return cameraConfig?.review.detections.labels
|
||||||
? cameraConfig.review.detections.labels
|
? cameraConfig.review.detections.labels
|
||||||
.map((label) => t(label, { ns: "objects" }))
|
.map((label) =>
|
||||||
|
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
|
||||||
|
)
|
||||||
.join(", ")
|
.join(", ")
|
||||||
: "";
|
: "";
|
||||||
}, [cameraConfig, t]);
|
}, [cameraConfig, t]);
|
||||||
|
|||||||
@ -366,7 +366,7 @@ function ObjectList({ cameraConfig, objects }: ObjectListProps) {
|
|||||||
{getIconForLabel(obj.label, "size-5 text-white")}
|
{getIconForLabel(obj.label, "size-5 text-white")}
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-3 text-lg">
|
<div className="ml-3 text-lg">
|
||||||
{capitalizeFirstLetter(obj.label.replaceAll("_", " "))}
|
{t(obj.label, { ns: "objects" })}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex w-8/12 flex-row items-center justify-end">
|
<div className="flex w-8/12 flex-row items-center justify-end">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user