From f238b6965ded2017ec87b663b2aa3aa37b0d3366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Sun, 4 Oct 2026 22:15:29 +0800 Subject: [PATCH] fix(desktop): translate text typed into components The header over the pictures in a reply read "1 IMAGE" in every locale. The text was typed into JSX, and the type of the locale files only proves that every key has a translation, not that components use one. A scan of the 246 components found more: Mermaid's error, loading text and preview hint, "Untitled" in the sidebar, Computer Use's "Failed to check status.", token counts in /context, labels in the trajectory view, and screen-reader labels such as the sidebar region and the diff grid. They now go through t(), reusing a key where one existed and adding 15 to all five locales. The English text is unchanged. untranslatedText.test.ts keeps it that way. It reads every component and fails on JSX text, text-bearing attributes and string literals rendered as children that skip t(). Key caps, code, icon ligatures and t() fallbacks are not prose. Product names, units and example values are listed per file with the reason, and a listed text the source no longer has fails too. Modal's "Close dialog" stays a known gap: a ui primitive cannot read the locale, so the label has to come from its callers. --- .../src/__tests__/untranslatedText.test.ts | 223 ++++++++++++++++++ .../chat/InlineImageGallery.test.tsx | 15 ++ .../components/chat/InlineImageGallery.tsx | 2 +- .../chat/LocalSlashCommandPanel.tsx | 8 +- .../src/components/chat/MermaidRenderer.tsx | 12 +- .../components/chat/ProjectContextChip.tsx | 2 +- desktop/src/components/chat/ToolCallGroup.tsx | 2 +- desktop/src/components/layout/Sidebar.tsx | 8 +- .../trajectory/detail/MessageBlocks.tsx | 3 +- .../trajectory/detail/RawRequestDetail.tsx | 2 +- .../workspace/WorkspaceDiffSurface.tsx | 2 +- desktop/src/i18n/locales/en.ts | 15 ++ desktop/src/i18n/locales/jp.ts | 15 ++ desktop/src/i18n/locales/kr.ts | 15 ++ desktop/src/i18n/locales/zh-TW.ts | 15 ++ desktop/src/i18n/locales/zh.ts | 15 ++ desktop/src/pages/ActivitySettings.tsx | 2 +- desktop/src/pages/ComputerUseSettings.tsx | 6 +- .../src/pages/settings/ProviderSettings.tsx | 2 +- 19 files changed, 339 insertions(+), 25 deletions(-) create mode 100644 desktop/src/__tests__/untranslatedText.test.ts diff --git a/desktop/src/__tests__/untranslatedText.test.ts b/desktop/src/__tests__/untranslatedText.test.ts new file mode 100644 index 00000000..ba5f8751 --- /dev/null +++ b/desktop/src/__tests__/untranslatedText.test.ts @@ -0,0 +1,223 @@ +// @vitest-environment node +import { readdirSync, readFileSync } from 'node:fs' +import path from 'node:path' +import ts from 'typescript' +import { describe, expect, it } from 'vitest' + +/** + * Text a user reads has to come from the locale files. A string typed straight + * into JSX renders the same in every locale, and nothing else notices: the + * "1 image" header over the pictures in a reply stayed English in the Chinese UI. + * + * So every component is read here. JSX text, the attributes a user reads or a + * screen reader speaks, and string literals rendered as children all have to go + * through `t()`. Text inside , ,
 or