From 91cc6747b6f1d67e8f3cc52b71fa73e58fe88bde Mon Sep 17 00:00:00 2001 From: GuoQing Liu <842607283@qq.com> Date: Mon, 12 Jan 2026 23:15:27 +0800 Subject: [PATCH] i18n miscellaneous fixes (#21614) * fix: fix face library unknown label i18n wrong * fix: fix review genai threat level i18n * fix: fix preview unknown label i18n * fix: fix AM/PM i18n display issue --- web/src/components/card/ClassificationCard.tsx | 4 ++-- web/src/components/overlay/chip/GenAISummaryChip.tsx | 8 +++++--- web/src/components/player/PreviewThumbnailPlayer.tsx | 4 +++- web/src/utils/dateUtil.ts | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/web/src/components/card/ClassificationCard.tsx b/web/src/components/card/ClassificationCard.tsx index ffd28a0d0..6581d109a 100644 --- a/web/src/components/card/ClassificationCard.tsx +++ b/web/src/components/card/ClassificationCard.tsx @@ -164,7 +164,7 @@ export const ClassificationCard = forwardRef< )} >
- {data.name == "unknown" + {data.name.toLowerCase() == "unknown" ? t("details.unknown") : data.name.toLowerCase() == "none" ? t("details.none") @@ -336,7 +336,7 @@ export function GroupedClassificationCard({ {classifiedEvent?.label && classifiedEvent.label !== "none" ? classifiedEvent.label - : t(noClassificationLabel)} + : t(noClassificationLabel, { ns: i18nLibrary })} {classifiedEvent?.label && classifiedEvent.label !== "none" && classifiedEvent.score !== undefined && ( diff --git a/web/src/components/overlay/chip/GenAISummaryChip.tsx b/web/src/components/overlay/chip/GenAISummaryChip.tsx index 46fefdc67..d5f7a9969 100644 --- a/web/src/components/overlay/chip/GenAISummaryChip.tsx +++ b/web/src/components/overlay/chip/GenAISummaryChip.tsx @@ -57,7 +57,7 @@ export function GenAISummaryDialog({ !aiAnalysis || (!aiAnalysis.potential_threat_level && !aiAnalysis.other_concerns) ) { - return "None"; + return t("label.none", { ns: "common" }); } let concerns = ""; @@ -74,7 +74,9 @@ export function GenAISummaryDialog({ label = t("securityConcern", { ns: "views/events" }); break; default: - label = THREAT_LEVEL_LABELS[threatLevel as ThreatLevel] || "Unknown"; + label = + THREAT_LEVEL_LABELS[threatLevel as ThreatLevel] || + t("details.unknown", { ns: "views/classificationModel" }); } concerns = `• ${label}\n`; } @@ -83,7 +85,7 @@ export function GenAISummaryDialog({ concerns += `• ${c}\n`; }); - return concerns || "None"; + return concerns || t("label.none", { ns: "common" }); }, [aiAnalysis, t]); // layout diff --git a/web/src/components/player/PreviewThumbnailPlayer.tsx b/web/src/components/player/PreviewThumbnailPlayer.tsx index 30339599a..517a83e7c 100644 --- a/web/src/components/player/PreviewThumbnailPlayer.tsx +++ b/web/src/components/player/PreviewThumbnailPlayer.tsx @@ -342,7 +342,9 @@ export default function PreviewThumbnailPlayer({ default: return ( THREAT_LEVEL_LABELS[threatLevel as ThreatLevel] || - "Unknown" + t("details.unknown", { + ns: "views/classificationModel", + }) ); } })()} diff --git a/web/src/utils/dateUtil.ts b/web/src/utils/dateUtil.ts index b007a9573..cc541214c 100644 --- a/web/src/utils/dateUtil.ts +++ b/web/src/utils/dateUtil.ts @@ -165,7 +165,7 @@ export const formatUnixTimestampToDateTime = ( // Uppercase AM/PM for 12-hour formats if (date_format.includes("a") || date_format.includes("aaa")) { formatted = formatted.replace(/am|pm/gi, (match) => - match.toUpperCase(), + i18n.t(`time.${match.toLowerCase()}`, { ns: "common" }).toUpperCase(), ); } return formatted; @@ -217,7 +217,7 @@ export const formatUnixTimestampToDateTime = ( // Uppercase AM/PM in fallback if (options.hour12) { fallbackFormatted = fallbackFormatted.replace(/am|pm/gi, (match) => - match.toUpperCase(), + i18n.t(`time.${match.toLowerCase()}`, { ns: "common" }).toUpperCase(), ); } return fallbackFormatted;