fix: fix system enrichments view classification i18n (#21366)

This commit is contained in:
GuoQing Liu
2025-12-20 20:45:31 +08:00
committed by GitHub
parent 60052e5f9f
commit 8a4d5f34da
2 changed files with 22 additions and 4 deletions

View File

@@ -88,11 +88,20 @@ export default function EnrichmentMetrics({
Object.entries(stats.embeddings).forEach(([rawKey, stat]) => {
const key = rawKey.replaceAll("_", " ");
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] = {
rawKey,
name: t("enrichments.embeddings." + rawKey),
name: seriesName,
metrics: getThreshold(rawKey),
data: [],
};
@@ -133,8 +142,14 @@ export default function EnrichmentMetrics({
isSpeed = false;
}
let categoryName = "";
// 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)) {
grouped[categoryKey] = {