Repository navigation
Commit 1ff1d45
feat(app-shell): marketplace card and package page show which languages an app ships (#31855)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbYH6pirAR8NaHkLvUrUr9cq)_
Part of #31462. The card, detail and null faces land here; the languages
facet follows in its own PR once the cloud lane names where the list
answer carries the `languages` counts (asked on the card, unanswered at
this head).
Part of #30284 (the console half; the cloud half is cloud#3803, live on
staging).
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- **改了什么**:应用市场卡片显示该应用最新版本支持的语言和翻译覆盖率(如「简体中文 100% · 日本語
60%」,最多三个,其余显示「+N more」),详情页在分类标签栏列出全部语言并标出默认语言;旧版本(未测量)显示「无语言信息」。
- **为什么改**:客户选应用时看不出它有没有中文等语言、翻译了多少;cloud#3803
已在发布时测量并下发这两个字段,控制台这一半负责显示。
- **风险与回滚**:只读显示,不改数据和接口;接口没返回这两个字段(生产环境目前就是这样)时页面和现在完全一样。回滚即还原本 PR。
-
**先看**:`ui/packages/app-shell/src/console/marketplace/shippedLanguages.ts`(三种回答的判定)、`MarketplaceLanguages.tsx`(卡片行与详情组)、`ui/packages/i18n/src/namespaces/marketplace/en.ts`(新增
4 个键)。
- **两分钟验证**:`cd ui && pnpm exec vitest run
packages/app-shell/src/console/marketplace/__tests__/MarketplacePage.facets-31011.test.tsx
packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.taxonomy-31011.test.tsx`,预期
25 个用例全绿。
- **需要你做的**:无,席位落地。
## What changes
- **`marketplaceApi.ts`** types the two keys cloud#3803 serves on every
version: `supported_locales: string[] | null` (the locales that carry
text, default first, as the app declares them) and `locale_coverage: {
default_locale, expected_keys, locales: [{ locale, translated,
coverage_percent }] } | null`. Both optional: a catalog that does not
serve them yet still type-checks and reads as absent.
- **`shippedLanguages.ts`** (new) reads a version into one of three
answers, kept apart on purpose:
- keys absent: `unserved`, nothing drawn, so the CONTROL catalog renders
exactly as before;
- `supported_locales: null`: `unknown`, "No language information", never
"English only";
- a list: each locale in served order with its served `coverage_percent`
(a locale the coverage has no row for is drawn without a percent), the
first marked default.
Names follow #30514's reading, with no second map:
`localeLabel(resolveBuiltInLanguage(code) ?? code)`, so `zh-CN` reads
简体中文 as in the language menu and `th`, outside the platform table, reads
ไทย. Percents are formatted with `Intl.NumberFormat` in
`useDisplayLocale()`, so no pack carries a format string.
- **`MarketplaceLanguages.tsx`** (new): the card's line (three
languages, then `+N more`; the full list in the tooltip and the
screen-reader text) and the package page's "Languages" group in the
taxonomy strip (every language, the default marked, the served code as
each badge's title).
- **`MarketplacePage.tsx` / `MarketplacePackagePage.tsx`** mount them:
the card under its description, the detail group after the taxonomy
groups, reading the version the page already calls latest.
- **`@object-ui/i18n`**: four keys in each of the eleven marketplace
catalogues (`namespaces/marketplace/*.ts`, `zh-Hant` regenerated by
`gen:zh-hant`): `marketplace.facet.languages`,
`marketplace.languages.none`, `marketplace.languages.more` (placeholder
`extra`), `marketplace.languages.default`. They are published through
the `./locales` entry (`en: typeof enPack & typeof enMarketplace`),
hence `Clause-②: yes (widening)`.
## Tests
New `describe` blocks in the existing harness files (each case drives
the rendered page through a stubbed `fetch` that answers the proxy's
body):
- `MarketplacePage.facets-31011.test.tsx` · "Marketplace card
languages": a measured version shows `English 100% · 简体中文 100% · 日本語 60%
· +1 more` with `ไทย 12.5%` in the tooltip and screen-reader text, and a
locale without a coverage row draws without a percent; a `null` version
reads "No language information" and not "English"; CONTROL, a catalog
without the keys draws no line.
- `MarketplacePackagePage.taxonomy-31011.test.tsx` · "Details — the
languages an app ships": the full list in served order with the default
marked; the `null` face; CONTROL, no group.
<details><summary>Runs at head 6351a1a (the merge of main d6e28c0
brought no ui or spec change; the suites below ran on the branch commits
before it and were re-run where a later commit touched their
files)</summary>
- `@object-ui/i18n` whole package, plus every file under
`console/marketplace/__tests__/` and the three `LocaleSwitcher` tests:
`Test Files 161 passed (161)`, `Tests 2403 passed | 13 skipped`. The de
quote-pairing, count-family, untranslated-identity, machine-locale and
namespace censuses are in that run.
- The two touched harness files plus
`ui/scripts/__tests__/percent-storage-callers-11475.test.ts` after the
last source commit: `Test Files 3 passed (3)`, `Tests 38 passed (38)`.
- `pnpm --dir ui exec vitest run scripts/`: `Test Files 170 passed | 2
skipped (172)`, `Tests 5027 passed`.
- `turbo run type-check --filter=@object-ui/app-shell
--filter=@object-ui/i18n`: 70/70 tasks, both `type-check` tasks executed
(cache miss).
- `node ui/scripts/check-i18n-en-drift.mjs`: exit 0 (no designer en
value changed); `eslint` on the touched files: 0 errors.
</details>
<details><summary>Ablation (each leg through
scripts/ablation-replace.mjs, restored to the HEAD blob
c87a3e4)</summary>
- `if (served === null) return UNKNOWN;` → `return UNSERVED`: exactly
the two null-face cases go red (`2 failed | 23 passed`).
- `if (!Array.isArray(served)) return UNSERVED;` → `return UNKNOWN`:
exactly the two CONTROL cases go red (`2 failed | 23 passed`).
</details>
## Acceptance notes
- **Live verification NOT MEASURED: staging is unreachable from this
container** (the egress proxy answers 403 to CONNECT for the cloud
hosts), and the cloud repository is not readable from this lane, so the
served shape is the card's statement and there are no live screenshots.
Production does not serve the keys yet (cloud seat reading on the card);
there the page reads exactly as today.
- **The languages facet is not in this PR.** Its values can only come
from the served counts, and the card does not say where the list answer
carries them (`data.facets.languages`, `data.languages`, a record keyed
by tag…). The question is on the card for the cloud lane; the facet
follows in its own PR once answered, never on a guessed shape.
- **#31834**: on the public snapshot path
(`OS_MARKETPLACE_PUBLIC_BASE_URL` set) the runtime's marketplace proxy
filters and pages the catalog itself and does not read `?languages=`, so
a languages filter would answer the unfiltered catalog. It is filed
separately (`packages/cloud-connection`, outside this card's surface);
the default path, which forwards the query to the cloud unchanged, is
the one this card builds on.
- The spec's `MarketplaceSearchRequestSchema` /
`MarketplaceSearchResponseSchema` declare no `languages`; the cloud list
door does not answer that schema today either. Noted, not changed here
(no `packages/spec` in the claim).
## Verification
- Derived gate list (`dispatch-gates --commands`, 39 commands): all run
locally, exit 0, reconciled with `--ran` (39 derived, 39 run, 0
NOT-MEASURED). 34 re-ran at head 6351a1a; `pnpm --dir ui exec vitest
run scripts/` and `pnpm check:type-check-debt` ran at the last branch
commit before the merge of main, which brought no ui or spec change; the
three PR-body gates and `check-partof-closing-keyword` ran against this
body.
- `node scripts/check-sdui-manifest.mjs` and its `--self-test`: exit 0.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jUUskSunPYptce52wd)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c8223fb commit 1ff1d45
19 files changed
Lines changed: 450 additions & 0 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/console/marketplace
- __tests__
- i18n/src/namespaces/marketplace
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
1391 | 1392 | | |
1392 | 1393 | | |
1393 | 1394 | | |
| 1395 | + | |
| 1396 | + | |
1394 | 1397 | | |
1395 | 1398 | | |
1396 | 1399 | | |
| |||
1628 | 1631 | | |
1629 | 1632 | | |
1630 | 1633 | | |
| 1634 | + | |
| 1635 | + | |
1631 | 1636 | | |
1632 | 1637 | | |
1633 | 1638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
975 | 976 | | |
976 | 977 | | |
977 | 978 | | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
978 | 983 | | |
979 | 984 | | |
980 | 985 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
200 | 223 | | |
201 | 224 | | |
202 | 225 | | |
| |||
0 commit comments