Skip to content

Commit 1ff1d45

Browse files
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
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): the marketplace card and package page show which languages an app ships, with coverage
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
The control plane now measures, when a version is published, which languages it carries text for and how much of the app each one translates, and serves them on the version as `supported_locales` and `locale_coverage`. The marketplace reads them:
12+
13+
- **The catalog card** names the latest version's languages in their own script, the default first, each with its coverage (`简体中文 100% · 日本語 60%`). It shows three, then how many more; the full list is the line's tooltip and what a screen reader hears.
14+
- **The package page** lists every language in its taxonomy strip, the default marked.
15+
- **A version published before the measurement** reads "No language information", never "English only".
16+
- **A catalog that does not serve the keys yet** draws nothing new: the card and page look as they did.
17+
18+
A language is named the way the header's language menu names it: a served code is read through the platform locale table first, so `zh-CN` reads 简体中文, and a code outside the table is named by the browser in its own language (`th` reads ไทย). Percents are formatted in the display locale, as the page's dates are.
19+
20+
`@object-ui/i18n` adds four keys to every marketplace catalogue: `marketplace.facet.languages`, `marketplace.languages.none`, `marketplace.languages.more` and `marketplace.languages.default`.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/**
2+
* The languages a marketplace version ships, as the catalog card, the package
3+
* page and the languages facet draw them.
4+
*
5+
* The control plane measures them when a version is published (the version's
6+
* `supported_locales` and `locale_coverage`, see `marketplaceApi.ts`); the
7+
* console reads the answer and measures nothing itself. Three answers are
8+
* three different faces, and the reader keeps them apart:
9+
*
10+
* - the keys ABSENT — a catalog that does not serve them yet. Nothing is
11+
* drawn, so the page reads exactly as it did before the catalog served them.
12+
* - `supported_locales: null` — a version published before the measurement.
13+
* It reads "No language information", ⛔ never "English only": nothing was
14+
* measured, so nothing may be claimed.
15+
* - a list — the languages that carry text, the default first, each with the
16+
* coverage the measurement served for it.
17+
*
18+
* A language is named the way the header's language menu names it
19+
* (`localeLabel`, `layout/LocaleSwitcher.tsx`): a served code is first read
20+
* through the platform locale table (`resolveBuiltInLanguage`), so `zh-CN`
21+
* reads 简体中文 like the menu's entry, and a code outside the table is named
22+
* by the runtime in its own language (`th` → ไทย), else shown bare. There is
23+
* no second list of names here.
24+
*/
25+
26+
import { Languages } from 'lucide-react';
27+
import { Badge } from '@object-ui/components';
28+
import { useObjectTranslation } from '@object-ui/i18n';
29+
import type { MarketplacePackageVersion } from './marketplaceApi.js';
30+
import {
31+
CARD_LANGUAGE_LIMIT,
32+
readShippedLanguages,
33+
useCoverageFormatter,
34+
type ShippedLanguage,
35+
} from './shippedLanguages.js';
36+
37+
function languageText(language: ShippedLanguage, formatCoverage: (percent: number) => string): string {
38+
return language.percent === null ? language.label : `${language.label} ${formatCoverage(language.percent)}`;
39+
}
40+
41+
/**
42+
* The catalog card's line: the first `CARD_LANGUAGE_LIMIT` languages with
43+
* their coverage (`简体中文 100% · 日本語 60%`), then how many more. The whole
44+
* list is the line's tooltip and what a screen reader hears.
45+
*/
46+
export function CardLanguagesLine({ version }: { version: MarketplacePackageVersion | null | undefined }) {
47+
const { t } = useObjectTranslation();
48+
const formatCoverage = useCoverageFormatter();
49+
const shipped = readShippedLanguages(version);
50+
if (shipped.kind === 'unserved') return null;
51+
if (shipped.kind === 'unknown') {
52+
return (
53+
<p className="flex items-center gap-1.5 text-xs text-muted-foreground" data-testid="marketplace-card-languages" data-state="unknown">
54+
<Languages className="h-3.5 w-3.5 shrink-0" aria-hidden="true" />
55+
<span>{t('marketplace.languages.none')}</span>
56+
</p>
57+
);
58+
}
59+
const all = shipped.languages.map((language) => languageText(language, formatCoverage));
60+
const shown = all.slice(0, CARD_LANGUAGE_LIMIT);
61+
const extra = all.length - shown.length;
62+
const full = all.join(' · ');
63+
return (
64+
<p
65+
className="flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground"
66+
data-testid="marketplace-card-languages"
67+
data-state="listed"
68+
title={full}
69+
>
70+
<Languages className="h-3.5 w-3.5 shrink-0" aria-hidden="true" />
71+
<span className="truncate" aria-hidden="true">
72+
{shown.join(' · ')}
73+
{extra > 0 && ` · ${t('marketplace.languages.more', { extra })}`}
74+
</span>
75+
<span className="sr-only">{`${t('marketplace.facet.languages')}: ${full}`}</span>
76+
</p>
77+
);
78+
}
79+
80+
/**
81+
* The package page's group in its taxonomy strip: every language, the default
82+
* marked, each with its coverage; "No language information" for a version
83+
* that carries none.
84+
*/
85+
export function DetailLanguagesGroup({ version }: { version: MarketplacePackageVersion | null | undefined }) {
86+
const { t } = useObjectTranslation();
87+
const formatCoverage = useCoverageFormatter();
88+
const shipped = readShippedLanguages(version);
89+
if (shipped.kind === 'unserved') return null;
90+
const label = t('marketplace.facet.languages');
91+
return (
92+
<div
93+
role="group"
94+
aria-label={label}
95+
className="flex flex-wrap items-center gap-1.5"
96+
data-testid="marketplace-detail-languages"
97+
data-state={shipped.kind}
98+
>
99+
<span className="text-xs text-muted-foreground" aria-hidden="true">{label}</span>
100+
{shipped.kind === 'unknown' ? (
101+
<span className="text-xs text-muted-foreground">{t('marketplace.languages.none')}</span>
102+
) : (
103+
shipped.languages.map((language) => (
104+
<Badge
105+
key={language.code}
106+
variant="outline"
107+
className="font-normal"
108+
data-testid={`marketplace-detail-language-${language.code}`}
109+
title={language.code}
110+
>
111+
{languageText(language, formatCoverage)}
112+
{language.isDefault && (
113+
<span className="ml-1 text-muted-foreground">{t('marketplace.languages.default')}</span>
114+
)}
115+
</Badge>
116+
))
117+
)}
118+
</div>
119+
);
120+
}

‎ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ import type { SuggestedBinding } from '../../services/suggestedBindingsApi.js';
116116
import { errorCodeIs } from '@object-ui/types';
117117
import { MarketplaceNamespaceGate } from './MarketplaceNamespaceGate.js';
118118
import { effectiveSolutionType, readListingTaxonomy } from './marketplaceTaxonomy.js';
119+
import { DetailLanguagesGroup } from './MarketplaceLanguages.js';
119120

120121
/**
121122
* Whether a cloud install lands in the environment this console renders, read
@@ -1391,6 +1392,8 @@ function MarketplacePackagePageBody() {
13911392
const pkg = data.package;
13921393
const loc = localizePackage(pkg as any, language);
13931394
const latestVersion = pkg.latest_version?.version ?? data.versions[0]?.version ?? null;
1395+
// The version that string names: its languages are the ones the page draws.
1396+
const latestServedVersion = pkg.latest_version ?? data.versions[0] ?? null;
13941397
// PD4 (ADR-0025 §3.11): code-bearing packages must disclose + be acknowledged.
13951398
const containsCode = !!pkg.latest_version?.contains_code;
13961399
// ADR-0010 version lifecycle: installed cloud env is on an OLDER version than
@@ -1628,6 +1631,8 @@ function MarketplacePackagePageBody() {
16281631
))}
16291632
</div>
16301633
))}
1634+
{/* Every language the latest version ships, with coverage. */}
1635+
<DetailLanguagesGroup version={latestServedVersion} />
16311636
</div>
16321637
{localNotLoadedReason}
16331638
{loc.description && (

‎ui/packages/app-shell/src/console/marketplace/MarketplacePage.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { ConnectorCredentialsStep } from './ConnectorCredentialsStep.js';
6363
import { packagesHref } from '../../views/metadata-admin/packageSource.js';
6464
import { MarketplaceNamespaceGate } from './MarketplaceNamespaceGate.js';
6565
import { MarketplaceFacetFilters } from './MarketplaceFacetFilters.js';
66+
import { CardLanguagesLine } from './MarketplaceLanguages.js';
6667
import {
6768
EMPTY_FACET_SELECTION,
6869
NO_SERVED_FACETS,
@@ -975,6 +976,10 @@ function MarketplacePageBody() {
975976
<p className="text-sm text-muted-foreground line-clamp-2">
976977
{loc.description || t('marketplace.noDescription')}
977978
</p>
979+
{/* The languages the latest version ships, with coverage
980+
(`MarketplaceLanguages.tsx`); nothing on a catalog that
981+
does not serve them. */}
982+
<CardLanguagesLine version={pkg.latest_version} />
978983
<div className="flex items-center gap-2 mt-auto pt-2 flex-wrap">
979984
{/* objectui#11760 — a local install this runtime refused to
980985
load at startup (the listing's `notLoaded` marker) is not

‎ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.taxonomy-31011.test.tsx‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,59 @@ describe('Details — the marketplace taxonomy (objectstack#31011)', () => {
154154
expect(screen.queryByText('retail')).toBeNull();
155155
});
156156
});
157+
158+
/**
159+
* The package page's languages group (objectstack#31462), in the taxonomy
160+
* strip: every language the latest version ships, the default first and
161+
* marked, each with its coverage; "No language information" for a version
162+
* measured before the control plane measured languages; nothing when the
163+
* catalog serves neither key.
164+
*/
165+
describe('Details — the languages an app ships (objectstack#31462)', () => {
166+
const version = (extra: Record<string, unknown>) => ({ latest_version: { id: 'ver_crm_1', version: '1.0.0', ...extra } });
167+
168+
it('lists every language, the default first and marked, each with its coverage', async () => {
169+
await renderDetail(version({
170+
supported_locales: ['zh-CN', 'en', 'ja-JP', 'de', 'th'],
171+
locale_coverage: {
172+
default_locale: 'zh-CN',
173+
expected_keys: 120,
174+
locales: [
175+
{ locale: 'zh-CN', translated: 120, coverage_percent: 100 },
176+
{ locale: 'en', translated: 114, coverage_percent: 95 },
177+
{ locale: 'ja-JP', translated: 72, coverage_percent: 60 },
178+
{ locale: 'de', translated: 30, coverage_percent: 25 },
179+
{ locale: 'th', translated: 3, coverage_percent: 2.5 },
180+
],
181+
},
182+
}));
183+
184+
const group = screen.getByRole('group', { name: L.facet.languages });
185+
expect(group).toHaveAttribute('data-state', 'listed');
186+
expect(within(group).getAllByTestId(/^marketplace-detail-language-/).map((b) => b.textContent)).toEqual([
187+
`简体中文 100%${L.languages.default}`,
188+
'English 95%',
189+
'日本語 60%',
190+
'Deutsch 25%',
191+
'ไทย 2.5%',
192+
]);
193+
// The served code stays on the badge, so a reader can see what was declared.
194+
expect(screen.getByTestId('marketplace-detail-language-zh-CN')).toHaveAttribute('title', 'zh-CN');
195+
});
196+
197+
it('a version published before the measurement reads "No language information", never "English only"', async () => {
198+
await renderDetail(version({ supported_locales: null, locale_coverage: null }));
199+
200+
const group = screen.getByRole('group', { name: L.facet.languages });
201+
expect(group).toHaveAttribute('data-state', 'unknown');
202+
expect(group).toHaveTextContent(L.languages.none);
203+
expect(group).not.toHaveTextContent('English');
204+
});
205+
206+
it('CONTROL: a catalog that serves neither key draws no languages group', async () => {
207+
await renderDetail({});
208+
209+
expect(screen.queryByRole('group', { name: L.facet.languages })).toBeNull();
210+
expect(screen.queryByText(L.languages.none)).toBeNull();
211+
});
212+
});

‎ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePage.facets-31011.test.tsx‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,3 +399,80 @@ describe('Marketplace card badges (objectstack#31011)', () => {
399399
}
400400
});
401401
});
402+
403+
/**
404+
* The card's languages line (objectstack#31462): the latest version's
405+
* `supported_locales` and `locale_coverage`, as the control plane measured them
406+
* at publish. Three answers, three faces: a list draws the languages with their
407+
* coverage, an answered `null` reads "No language information" (never "English
408+
* only"), and absent keys draw nothing, so a catalog that does not serve them
409+
* reads as it did before.
410+
*/
411+
describe('Marketplace card languages (objectstack#31462)', () => {
412+
const COVERAGE = {
413+
default_locale: 'en',
414+
expected_keys: 80,
415+
locales: [
416+
{ locale: 'en', translated: 80, coverage_percent: 100 },
417+
{ locale: 'zh-CN', translated: 80, coverage_percent: 100 },
418+
{ locale: 'ja-JP', translated: 48, coverage_percent: 60 },
419+
{ locale: 'th', translated: 10, coverage_percent: 12.5 },
420+
],
421+
};
422+
const MEASURED = row('measured', 'Measured App', {
423+
latest_version: {
424+
id: 'ver_measured',
425+
version: '2.0.0',
426+
supported_locales: ['en', 'zh-CN', 'ja-JP', 'th'],
427+
locale_coverage: COVERAGE,
428+
},
429+
});
430+
const PAIR = row('pair', 'Pair App', {
431+
latest_version: {
432+
id: 'ver_pair',
433+
version: '1.1.0',
434+
supported_locales: ['zh-CN', 'en'],
435+
locale_coverage: { default_locale: 'zh-CN', expected_keys: 10, locales: [{ locale: 'en', translated: 7, coverage_percent: 70 }] },
436+
},
437+
});
438+
const OLD = row('old', 'Old App', {
439+
latest_version: { id: 'ver_old', version: '0.9.0', supported_locales: null, locale_coverage: null },
440+
});
441+
/** A catalog from before the measurement: neither key on the wire. */
442+
const UNSERVED = row('unserved', 'Unserved App', {});
443+
444+
const line = (id: string) => within(screen.getByTestId(`marketplace-card-com.acme.${id}`)).queryByTestId('marketplace-card-languages');
445+
446+
it('a measured version names its languages, default first, with coverage; three, then how many more', async () => {
447+
await renderPage(always([MEASURED, PAIR, OLD, UNSERVED]));
448+
449+
const measured = line('measured')!;
450+
expect(measured).toHaveAttribute('data-state', 'listed');
451+
// `zh-CN` is read through the platform locale table, as the language menu
452+
// names it; `th` is outside the table and named by the runtime.
453+
const full = 'English 100% · 简体中文 100% · 日本語 60% · ไทย 12.5%';
454+
expect(measured.querySelector('[aria-hidden="true"].truncate')).toHaveTextContent(
455+
`English 100% · 简体中文 100% · 日本語 60% · ${L.languages.more.replace('{{extra}}', '1')}`,
456+
);
457+
expect(measured).toHaveAttribute('title', full);
458+
expect(measured).toHaveTextContent(`${L.facet.languages}: ${full}`);
459+
// A language the coverage has no row for is drawn without a percent.
460+
expect(line('pair')!.querySelector('.truncate')).toHaveTextContent(/^简体中文 · English 70%$/);
461+
});
462+
463+
it('a version published before the measurement reads "No language information", never "English only"', async () => {
464+
await renderPage(always([OLD]));
465+
466+
const old = line('old')!;
467+
expect(old).toHaveAttribute('data-state', 'unknown');
468+
expect(old).toHaveTextContent(L.languages.none);
469+
expect(old).not.toHaveTextContent('English');
470+
});
471+
472+
it('CONTROL: a catalog that serves neither key draws no languages line', async () => {
473+
await renderPage(always([UNSERVED, ...TAXONOMY_CATALOG]));
474+
475+
expect(screen.queryAllByTestId('marketplace-card-languages')).toHaveLength(0);
476+
expect(screen.queryByText(L.languages.none)).toBeNull();
477+
});
478+
});

‎ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,29 @@ export interface MarketplacePackageVersion {
197197
signed?: boolean;
198198
/** Whether the marketplace counter-signed (reviewed + approved) this version. */
199199
platform_verified?: boolean;
200+
201+
/**
202+
* The languages this version ships, measured by the control plane when the
203+
* version was published (never authored): the locales that carry text, the
204+
* default first, as the app declares them (`zh-CN`). `null` on a version
205+
* published before the measurement — "no language information", never
206+
* "English only". Absent on a catalog that does not serve it yet, and then
207+
* nothing is drawn. `MarketplaceLanguages.tsx` reads it.
208+
*/
209+
supported_locales?: readonly string[] | null;
210+
/**
211+
* How much of the app each language translates, from the same measurement:
212+
* `coverage_percent` is `translated / expected_keys`, rounded to one decimal.
213+
* `null` and absent read as `supported_locales` does.
214+
*/
215+
locale_coverage?: MarketplaceLocaleCoverage | null;
216+
}
217+
218+
/** A version's measured translation coverage (`MarketplacePackageVersion.locale_coverage`). */
219+
export interface MarketplaceLocaleCoverage {
220+
default_locale: string;
221+
expected_keys: number;
222+
locales: readonly { locale: string; translated: number; coverage_percent: number }[];
200223
}
201224

202225
export interface MarketplaceListResponse {

0 commit comments

Comments
 (0)