fix: fix system enrichments view classification i18n (#21366)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions

This commit is contained in:
GuoQing Liu 2025-12-20 20:45:31 +08:00 committed by GitHub
parent 60052e5f9f
commit 8a4d5f34da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 4 deletions

View File

@ -192,7 +192,10 @@
"review_description_events_per_second": "Review Description", "review_description_events_per_second": "Review Description",
"object_description": "Object Description", "object_description": "Object Description",
"object_description_speed": "Object Description Speed", "object_description_speed": "Object Description Speed",
"object_description_events_per_second": "Object Description" "object_description_events_per_second": "Object Description",
"classification": "{{name}} Classification",
"classification_speed": "{{name}} Classification Speed",
"classification_events_per_second": "{{name}} Classification Events Per Second"
} }
} }
} }

View File

@ -88,11 +88,20 @@ export default function EnrichmentMetrics({
Object.entries(stats.embeddings).forEach(([rawKey, stat]) => { Object.entries(stats.embeddings).forEach(([rawKey, stat]) => {
const key = rawKey.replaceAll("_", " "); const key = rawKey.replaceAll("_", " ");
if (!(key in series)) { if (!(key in series)) {
const classificationIndex = rawKey.indexOf("_classification_");
const seriesName =
classificationIndex === -1
? t("enrichments.embeddings." + rawKey)
: t(
`enrichments.embeddings.${rawKey.substring(classificationIndex + 1)}`,
{
name: rawKey.substring(0, classificationIndex),
},
);
series[key] = { series[key] = {
rawKey, rawKey,
name: t("enrichments.embeddings." + rawKey), name: seriesName,
metrics: getThreshold(rawKey), metrics: getThreshold(rawKey),
data: [], data: [],
}; };
@ -133,8 +142,14 @@ export default function EnrichmentMetrics({
isSpeed = false; isSpeed = false;
} }
let categoryName = "";
// Get translated category name // Get translated category name
const categoryName = t("enrichments.embeddings." + categoryKey); if (categoryKey.endsWith("_classification")) {
const name = categoryKey.replace("_classification", "");
categoryName = t("enrichments.embeddings.classification", { name });
} else {
categoryName = t("enrichments.embeddings." + categoryKey);
}
if (!(categoryKey in grouped)) { if (!(categoryKey in grouped)) {
grouped[categoryKey] = { grouped[categoryKey] = {