fix(web): localize design-system import errors (#2686)#6075
Open
arseniy-gl wants to merge 2 commits into
Open
Conversation
…or shown in zh-CN A failing test in DesignSystemsSection.test.tsx anchors the bug: when the daemon rejects a design-system import (e.g. BAD_REQUEST from a local path check), the Settings form renders the raw `result.error.message` (English) directly in the Chinese UI. The fix will route the error envelope through a localized formatter (formatDesignSystemImportError) that maps `code` → i18n key and keeps the raw detail under a <details> disclosure. Refs nexu-io#2686.
The daemon returns English error messages for design-system import failures, and the Settings form rendered them raw — so every non-English locale saw English text in an otherwise localized UI. The fix routes the error envelope through `designSystemImportErrorKey`, which maps `code` (`BAD_REQUEST` / `INTERNAL_ERROR`) to a new i18n key. The localized summary replaces the raw English as the user-facing message, while the raw daemon detail (paths, URLs) remains accessible under a <details> disclosure for diagnostics. - New runtime helper: `apps/web/src/runtime/design-system-import-error.ts` - 3 new i18n keys across all 19 locales - Component change: `DesignSystemsSection.tsx` stores the full error envelope (with `code`) instead of just the message string - Red spec: `DesignSystemsSection.test.tsx` proves the raw English is no longer the primary visible text in zh-CN - Unit tests for the code-to-key mapping Fixes nexu-io#2686
Contributor
|
Thanks @arseniy-gl — good catch localizing the import failure summary while still keeping the raw daemon detail available for debugging. I'll route the PR through the usual triage steps now and keep the thread updated if anything needs action from your side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2686
Why
When a design system import fails, the daemon returns an English error message and the Settings form shows it as-is. Every non-English locale (zh-CN, ru, fr, de, and 15 others) sees English text inside an otherwise fully localized UI. The issue was reported by a Chinese user, but the bug affects all 19 locales.
I found this while looking for a good first issue after my first contribution (#5836). The scope matched what @lefarcen described in the issue: a UI-side fix that maps the daemon error code to a localized key.
What users will see
BAD_REQUESTorINTERNAL_ERROR) fall back to the raw message, same as before.Surface area
designSystemsImportErrorInvalid,designSystemsImportErrorInternal,designSystemsImportErrorDetails) added totypes.tsand all 19 locale filesScreenshots
No new UI surface — the change is in the error text that appears in the existing import form. The layout and controls are unchanged.
Bug fix verification
apps/web/tests/components/DesignSystemsSection.test.tsx— new describe block "import error localization (issue Chinese UI still shows English error messages in the design system import flow #2686)"mainand green on this branch? yesmain: the test fails because the raw English textlocal project path must be a directoryis rendered in the Chinese UI<details>apps/web/tests/runtime/design-system-import-error.test.tsValidation
pnpm --filter @open-design/web typecheck— clean (catches missing locale entries via the typedDict)pnpm --filter @open-design/web test— 4768 passed, 439 filespnpm guard— only pre-existingapps/telemetry-workerENOENT failure (same asmain, verified via stash)Adjacent issues
The same raw-English-error pattern exists in
apps/web/src/components/SkillsSection.tsx:360,394(setDraftError(result.error.message)without localization). That is a separate surface with its own error categories — out of scope for this PR. I will file a follow-up issue.