Skip to content

feat(skill-reco): show the recommendation card in the UI language - #805

Merged
huichen merged 1 commit into
mainfrom
fix/skill-reco-locale
Sep 23, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/skill-reco-locale

Conversation

@huichen

@huichen huichen commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

feat(skill-reco): show the recommendation card in the UI language

The card showed the catalogue's English description even in a Chinese UI:
SkillsView and the composer's / menu both fall back to descriptionZh, but
the recommendation card rendered whatever the agent echoed — which is the
English line the client sent as a candidate.

The card's text now follows the UI language, while the candidate sent to the
recommender deliberately does not: that payload is what the 100-question
evaluation measured (docs/internals/skill_reco/evaluation.md), and a display
decision must not move numbers it was tuned on. shownDescription therefore
localizes on the way out, using the Chinese line the catalogue already carries
and falling back to the English echo when a skill has none. The slash command,
the install, the daily budget and the duplicate rules are untouched — the name
is what the flow acts on.

  • desktop: the hook reads i18n.language (through a ref, since evaluate is
    created once) and builds the id → descriptionZh map from the same cached
    catalogue read that produces the candidates.
  • mobile: ChatScreen passes its i18n.language to the hook; the phone keeps
    its own budget and needs no other change.
  • The TUI is left alone: its chrome is English, it has no language setting, and
    its candidate list already prefers whichever line the catalogue has.

Tests: desktop (21 in the hook's suite, incl. the zh card and the unchanged
English payload) and mobile (15, incl. both languages). Desktop suites green
(144 files / 1248 tests), mobile green (123 / 1868). The screenshot scenario
skill-reco-card now asserts the Chinese line under ?lang=zh — verified
against the harness, and the assertion was checked to fail when the English
text is asserted instead.

The card showed the catalogue's English `description` even in a Chinese UI:
SkillsView and the composer's `/` menu both fall back to `descriptionZh`, but
the recommendation card rendered whatever the agent echoed — which is the
English line the client sent as a candidate.

The card's text now follows the UI language, while the candidate sent to the
recommender deliberately does not: that payload is what the 100-question
evaluation measured (`docs/internals/skill_reco/evaluation.md`), and a display
decision must not move numbers it was tuned on. `shownDescription` therefore
localizes on the way out, using the Chinese line the catalogue already carries
and falling back to the English echo when a skill has none. The slash command,
the install, the daily budget and the duplicate rules are untouched — the name
is what the flow acts on.

- desktop: the hook reads `i18n.language` (through a ref, since `evaluate` is
  created once) and builds the id → descriptionZh map from the same cached
  catalogue read that produces the candidates.
- mobile: `ChatScreen` passes its `i18n.language` to the hook; the phone keeps
  its own budget and needs no other change.
- The TUI is left alone: its chrome is English, it has no language setting, and
  its candidate list already prefers whichever line the catalogue has.

Tests: desktop (21 in the hook's suite, incl. the zh card and the unchanged
English payload) and mobile (15, incl. both languages). Desktop suites green
(144 files / 1248 tests), mobile green (123 / 1868). The screenshot scenario
`skill-reco-card` now asserts the Chinese line under `?lang=zh` — verified
against the harness, and the assertion was checked to fail when the English
text is asserted instead.
@huichen
huichen enabled auto-merge (squash) September 23, 2026 14:07
@huichen
huichen merged commit 760dee8 into main Sep 23, 2026
12 checks passed
@huichen
huichen deleted the fix/skill-reco-locale branch September 23, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant