diff --git a/ui/src/i18n/.i18n/raw-copy-baseline.json b/ui/src/i18n/.i18n/raw-copy-baseline.json index b1677b3366fe..100023cccc4c 100644 --- a/ui/src/i18n/.i18n/raw-copy-baseline.json +++ b/ui/src/i18n/.i18n/raw-copy-baseline.json @@ -456,13 +456,6 @@ "path": "ui/src/pages/channels/view.nostr.ts", "text": "NIP-05" }, - { - "count": 2, - "kind": "html-text", - "name": "text", - "path": "ui/src/pages/chat/components/chat-message-bubble.ts", - "text": "JSON" - }, { "count": 1, "kind": "html-text", diff --git a/ui/src/i18n/locales/en.ts b/ui/src/i18n/locales/en.ts index 62c6a91fbf2f..ba14caaf60f4 100644 --- a/ui/src/i18n/locales/en.ts +++ b/ui/src/i18n/locales/en.ts @@ -4846,6 +4846,10 @@ export const en: TranslationMap = { }, codeBlock: { jsonLines: "JSON ยท {count} lines", + jsonBadge: "JSON", + jsonArrayItem: "Array ({count} item)", + jsonArrayItems: "Array ({count} items)", + jsonObjectKeys: "Object ({count} keys)", }, workspaceConflict: { titleOne: "1 cloud workspace conflict", @@ -5092,6 +5096,7 @@ export const en: TranslationMap = { showLess: "Show less", showMore: "Show more", unknownDate: "Unknown date", + toolSender: "Tool", voiceNote: "Voice note", duplicatesCollapsed: "{count} consecutive identical messages collapsed", contextFor: "Message context for {timestamp}", diff --git a/ui/src/pages/chat/components/chat-message-bubble.ts b/ui/src/pages/chat/components/chat-message-bubble.ts index fd7314dd0105..35d841cb02a5 100644 --- a/ui/src/pages/chat/components/chat-message-bubble.ts +++ b/ui/src/pages/chat/components/chat-message-bubble.ts @@ -511,7 +511,7 @@ export function renderGroupedMessage( ?open=${Boolean(opts.autoExpandToolCalls)} > - JSON + ${t("chat.codeBlock.jsonBadge")} ${jsonSummaryLabel(jsonResult.parsed)} @@ -575,7 +575,7 @@ export function renderGroupedMessage( ${jsonResult ? html`
- JSON + ${t("chat.codeBlock.jsonBadge")} ${jsonSummaryLabel(jsonResult.parsed)}
${jsonResult.pretty}
diff --git a/ui/src/pages/chat/components/chat-message-group.ts b/ui/src/pages/chat/components/chat-message-group.ts index 46cf15f042f1..dab3b21cd421 100644 --- a/ui/src/pages/chat/components/chat-message-group.ts +++ b/ui/src/pages/chat/components/chat-message-group.ts @@ -334,7 +334,7 @@ export function resolveMessageGroupSenderLabel( : normalizedRole === "assistant" ? (userLabel ?? assistantName) : normalizedRole === "tool" - ? "Tool" + ? t("chat.messages.toolSender") : group.messages.every((item) => Boolean(workspaceResultConflictFromTranscript(item.message)), ) diff --git a/ui/src/pages/chat/components/chat-message-markdown.ts b/ui/src/pages/chat/components/chat-message-markdown.ts index 1a80b3b53d59..d64ff782d9f9 100644 --- a/ui/src/pages/chat/components/chat-message-markdown.ts +++ b/ui/src/pages/chat/components/chat-message-markdown.ts @@ -52,16 +52,19 @@ export function detectJson(text: string): { parsed: unknown; pretty: string } | /** Build a short summary label for collapsed JSON (type + key count or array length). */ export function jsonSummaryLabel(parsed: unknown): string { if (Array.isArray(parsed)) { - return `Array (${parsed.length} item${parsed.length === 1 ? "" : "s"})`; + return t( + parsed.length === 1 ? "chat.codeBlock.jsonArrayItem" : "chat.codeBlock.jsonArrayItems", + { count: String(parsed.length) }, + ); } if (parsed && typeof parsed === "object") { const keys = Object.keys(parsed as Record); if (keys.length <= 4) { return `{ ${keys.join(", ")} }`; } - return `Object (${keys.length} keys)`; + return t("chat.codeBlock.jsonObjectKeys", { count: String(keys.length) }); } - return "JSON"; + return t("chat.codeBlock.jsonBadge"); } export type MessageActionDetails = {