From 585c2bdba38992564a987199850ff0c49e99c665 Mon Sep 17 00:00:00 2001 From: "clawsweeper[bot]" <274271284+clawsweeper[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 13:58:07 -0700 Subject: [PATCH] fix: Found one low-severity UI localization regression in the markdown (#74600) Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com> --- ui/src/ui/markdown.test.ts | 18 ++++++++++++++++++ ui/src/ui/markdown.ts | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ui/src/ui/markdown.test.ts b/ui/src/ui/markdown.test.ts index f637d4726a5..27bd5db94d4 100644 --- a/ui/src/ui/markdown.test.ts +++ b/ui/src/ui/markdown.test.ts @@ -1,5 +1,6 @@ import { render } from "lit"; import { describe, expect, it, vi } from "vitest"; +import { i18n } from "../i18n/index.ts"; import { md, toSanitizedMarkdownHtml } from "./markdown.ts"; import { renderMarkdownSidebar } from "./views/markdown-sidebar.ts"; @@ -317,6 +318,23 @@ describe("toSanitizedMarkdownHtml", () => { expect(html).toContain("data-code="); }); + it("keeps localized copy labels fresh after locale changes", async () => { + const markdown = "```ts\nconst localizedCopy = true;\n```"; + await i18n.setLocale("en"); + const english = toSanitizedMarkdownHtml(markdown); + + try { + await i18n.setLocale("zh-CN"); + const chinese = toSanitizedMarkdownHtml(markdown); + + expect(english).toContain(">Copy<"); + expect(chinese).toContain(">复制<"); + expect(chinese).not.toContain(">Copy<"); + } finally { + await i18n.setLocale("en"); + } + }); + it("collapses JSON code blocks", () => { const html = toSanitizedMarkdownHtml('```json\n{"key": "value"}\n```'); expect(html).toContain("