Fix some page i18n wrong (#17682)

* fix: some pages can't translation object label.

* revert: revert wrong label fix

* feat: add openai base_url setting

* fix: fix classification modelSize i18n error

* revert: revert openai base_url setting

* fix: fix enrichments pages i18n keys wrong

* fix: fix mobile bottom bar reindexing embeddings i18n wrong

* feat: add more system stats i18n keys

* fix: fix review filter objects i18n

* chore: remove frigate+ label i18n
This commit is contained in:
GuoQing Liu
2025-04-19 09:02:15 -05:00
committed by GitHub
parent 89b54f19c8
commit c8e22a3653
14 changed files with 82 additions and 28 deletions
@@ -498,7 +498,7 @@ export function GeneralFilterContent({
{allLabels.map((item) => (
<FilterSwitch
key={item}
label={item.replaceAll("_", " ")}
label={t(item, { ns: "objects" })}
isChecked={filter.labels?.includes(item) ?? false}
onCheckedChange={(isChecked) => {
if (isChecked) {
@@ -263,7 +263,9 @@ function GeneralFilterButton({
}
if (selectedLabels.length == 1) {
return t(selectedLabels[0], { ns: "objects" });
return t(selectedLabels[0], {
ns: "objects",
});
}
return t("labels.count", {
+8 -2
View File
@@ -419,7 +419,9 @@ 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 t(filterValues as string, {
ns: "objects",
});
} else if (filterType === "search_type") {
return t("filter.searchType." + (filterValues as string));
} else {
@@ -817,7 +819,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"
>
{t("filter.label." + filterType)}:{" "}
{value.replaceAll("_", " ")}
{filterType === "labels"
? t(value, {
ns: "objects",
})
: value.replaceAll("_", " ")}
<button
onClick={() =>
removeFilter(filterType as FilterType, value)
+9 -2
View File
@@ -16,6 +16,7 @@ import { Link } from "react-router-dom";
import { cn } from "@/lib/utils";
import { isIOS, isMobile } from "react-device-detect";
import { isPWA } from "@/utils/isPWA";
import { useTranslation } from "react-i18next";
function Bottombar() {
const navItems = useNavigation("secondary");
@@ -43,6 +44,7 @@ type StatusAlertNavProps = {
className?: string;
};
function StatusAlertNav({ className }: StatusAlertNavProps) {
const { t } = useTranslation(["views/system"]);
const { data: initialStats } = useSWR<FrigateStats>("stats", {
revalidateOnFocus: false,
});
@@ -82,14 +84,19 @@ function StatusAlertNav({ className }: StatusAlertNavProps) {
clearMessages("embeddings-reindex");
addMessage(
"embeddings-reindex",
`Reindexing embeddings (${Math.floor((reindexState.processed_objects / reindexState.total_objects) * 100)}% complete)`,
t("stats.reindexingEmbeddings", {
processed: Math.floor(
(reindexState.processed_objects / reindexState.total_objects) *
100,
),
}),
);
}
if (reindexState.status === "completed") {
clearMessages("embeddings-reindex");
}
}
}, [reindexState, addMessage, clearMessages]);
}, [reindexState, addMessage, clearMessages, t]);
if (!messages || Object.keys(messages).length === 0) {
return;
@@ -596,7 +596,9 @@ export default function ObjectLifecycle({
<div className="text-md mr-2 w-1/3">
<div className="flex flex-col items-end justify-start">
<p className="mb-1.5 text-sm text-primary-variant">
Zones
{t(
"objectLifecycle.lifecycleItemDesc.header.zones",
)}
</p>
{item.class_type === "entered_zone"
? 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="flex flex-col items-end justify-start">
<p className="mb-1.5 text-sm text-primary-variant">
Ratio
{t(
"objectLifecycle.lifecycleItemDesc.header.ratio",
)}
</p>
{Array.isArray(item.data.box) &&
item.data.box.length >= 4
@@ -641,7 +645,7 @@ export default function ObjectLifecycle({
<div className="text-md mr-2 w-1/3">
<div className="flex flex-col items-end justify-start">
<p className="mb-1.5 text-sm text-primary-variant">
Area
{t("objectLifecycle.lifecycleItemDesc.header.area")}
</p>
{Array.isArray(item.data.box) &&
item.data.box.length >= 4 ? (
@@ -320,7 +320,11 @@ export default function ReviewDetailDialog({
ns="views/explore"
values={{
objects: missingObjects
.map((x) => t(x, { ns: "objects" }))
.map((x) =>
t(x, {
ns: "objects",
}),
)
.join(", "),
}}
>
@@ -709,7 +709,9 @@ function ObjectDetailsTab({
<div className="text-sm text-primary/40">{t("details.label")}</div>
<div className="flex flex-row items-center gap-2 text-sm capitalize">
{getIconForLabel(search.label, "size-4 text-primary")}
{t(search.label, { ns: "objects" })}
{t(search.label, {
ns: "objects",
})}
{search.sub_label && ` (${search.sub_label})`}
{isAdmin && (
<Tooltip>
@@ -980,7 +982,7 @@ function ObjectDetailsTab({
description={
search.label
? t("details.editSubLabel.desc", {
label: t(search.label, { ns: "objects" }),
label: search.label,
})
: t("details.editSubLabel.descNoLabel")
}
@@ -995,7 +997,7 @@ function ObjectDetailsTab({
description={
search.label
? t("details.editLPR.desc", {
label: t(search.label, { ns: "objects" }),
label: search.label,
})
: t("details.editLPR.descNoLabel")
}