Repository navigation
fix(desktop-service): show the crash-consent dialog in the active UI language - #858
Open
Yuncan050115 wants to merge 1 commit into
Open
Yuncan050115 wants to merge 1 commit into
Yuncan050115 wants to merge 1 commit into
Conversation
…language The aggregated upload confirmation passed literal Chinese strings to dialog.showMessageBox, so every non-Chinese locale received a consent dialog it could not read (issue dataelement#855). This is the same surface class the window-recovery prompts already solve through application-locale. Route title, message, detail and both buttons through the existing en/zh catalog, extended with crashConsent.* keys, and interpolate the per-report values (version, kind, line count, aggregation clause) with a new formatApplicationText helper. The factory resolves the locale per prompt via an injected getter, so a mid-session language switch applies to the next dialog; index.ts passes the same harnessLocale used by the other native dialogs, and initializeDesktopService falls back to the machine language (resolveHarnessLocale) rather than freezing Chinese when no source is wired. zh copy is preserved verbatim, including the aggregation clause the existing test asserts. Adds behavior regressions: an English prompt with interpolated values and no CJK characters, and a per-prompt re-resolution across a locale switch. Both fail on the previous hardcoded strings.
Yuncan050115
force-pushed
the
fix/crash-consent-locale
branch
from
November 5, 2026 17:41
1836d58 to
7bce562
Compare
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.
Refs #855.
What
createAggregatedUploadConfirmationpasses literal Chinese strings straight todialog.showMessageBox— title, message, detail and both buttons:so on any non-Chinese UI the dialog that decides whether diagnostic data gets uploaded cannot be read. Unlike #844, this surface never consults a locale at all: the main process has the
application-localecatalog the window-recovery prompts use, the consent dialog simply was not wired to it.Change
src/main/desktop-service/index.tsrenders the dialog through that catalog. SixcrashConsent.*keys joinsrc/main/application-locale.ts— the zh strings are kept verbatim, including the aggregation clause the existing test asserts — and a smallformatApplicationTexthelper interpolates the per-report values (version, kind, line count, aggregation). The locale is resolved per prompt through an injectedgetLocale;index.tspasses the sameharnessLocalethe other native dialogs already use, andinitializeDesktopServicefalls back to the machine language instead of freezing Chinese if a future caller forgets to wire it.defaultId/cancelId, the button order andapproved === response === 1keep their meaning; a dialog already open is not re-rendered mid-flight.Test plan
test/aggregated-upload-confirmation.test.ts: the English prompt carries every interpolated value and no CJK text, and a locale switch between prompts is honored. Verified red with only the three source files reverted (expected '发送故障报告' to be 'Send crash report'); the six existing zh cases — including the aggregation assertion — pass before and after.vitest run test/aggregated-upload-confirmation.test.ts test/application-locale.test.ts test/window-restart-prompt.test.ts test/desktop-service.test.ts: 4 files / 59 tests passed.vitest runwith the same exclusionsrelease.ymluses: 59 failed / 2724 passed against 59 failed / 2722 passed on the parent commit — failure set unchanged, delta is exactly the two new cases.npm run typecheckpassed;git diff --checkclean.npm test'spretest(office:prepare) hitsEPERMcreating a LibreOffice temp dir in this environment, so build/packaging acceptance did not run here.