fix(desktop): localize the Bot Mode group row's member count and availability - #108979
Closed
vadimcomanescu wants to merge 1 commit into
Closed
vadimcomanescu wants to merge 1 commit into
vadimcomanescu wants to merge 1 commit into
Conversation
…lability
The group row's empty-room preview and its aria-label spelled
`${members.length} bots` and `${available} of ${total} available` as
literals, so a reader on ja, zh or zh-hant saw English in a row whose
neighbours were translated. The bundle already carries `group.memberCount`
in all four locales (a7db531 moved it there) and `group-chat-view.tsx`
renders through it; the row's rebuild (5afa487) reintroduced the literal
next to the bundle accessor it already holds.
Route both through the bundle: the preview and the aria-label's count use
`group.memberCount`, and a new `group.availableCount(available, total)`
carries the availability sentence in all four locales, for the aria-label
and the tooltip that share it. `'You'` in the last-message preview stays a
literal on purpose: it is the persisted author sentinel the bundle header
describes.
Tests: `i18n-test-helper` gains `translateBotsIn(locale)`, since a case that
has to tell a catalog string from an English literal cannot do it under
`en`. The new group-row case renders the same row under `en` and `ja` and
reads the preview and the accessible name; it fails on the previous source.
Collaborator
|
Thanks @vadimcomanescu — this landed on main through #113430 (fix(bot-mode): roster menu and group row speak the active language (#91667, #108978, salva), merged as 4d46d76. Your commits/analysis were carried in with credit (see that PR's body and Co-authored-by trailers); the salvage rebased onto current main, widened to sibling surfaces where the review found gaps, and was live-verified in the real Electron app. Closing this one as superseded — thank you for the fix. |
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.
What does this PR do?
The Bot Mode group row spelled its empty-room preview (
${members.length} bots) and its accessible name (${group}, ${members.length} bots, ${available} of ${total} available) as English literals, so a reader on ja, zh or zh-hant saw English in a row whose neighbours were translated, and a screen reader read English for the room the group chat pane names in the active language. The bundle already carriesgroup.memberCountin all four locales (a7db531 moved it there) andgroup-chat-view.tsxrenders through it; the row's rebuild (5afa487) reintroduced the literal next to theuseBots()accessor the component already holds.The preview and the aria-label's count now go through
group.memberCount. The availability sentence had no key, sogroup.availableCount(available, total)is added in en, ja, zh and zh-hant, for the aria-label and the tooltip that share it.'You'in the last-message preview stays a literal on purpose: it is the persisted author sentinel the bundle's header describes.Related Issue
Fixes #108978
Type of Change
Changes Made
apps/desktop/src/plugins/hermes-bots/bot-row.tsx:GroupRowrenders the preview and the aria-label's count withb.group.memberCount, and the availability sentence withb.group.availableCount.apps/desktop/src/plugins/hermes-bots/i18n.ts:group.availableCount(available, total)in the type and in all four bundles.apps/desktop/src/plugins/hermes-bots/i18n-test-helper.ts:translateBotsIn(locale);translateBotsistranslateBotsIn('en'), unchanged for existing callers.apps/desktop/src/plugins/hermes-bots/bot-row.test.tsx: the mock resolves against a chosen locale; one new case renders the same group row underenandjaand reads the preview and the button's accessible name.How to Test
cd apps/desktop && npx vitest run --project ui src/plugins/hermes-bots/bot-row.test.tsx. Observed: 8 passed.bot-row.tsxand rerun. Observed: the new case fails on the Japanese preview (ボット3体not found), so it pins the fix rather than restating it.npx tsc -p . --noEmit,npx eslintandnpx prettier --checkon the four files. Observed: clean.ボット3体and the accessibility inspector shows the localized name.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A, no documented surface changescli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs