Skip to content

Commit 02a290f

Browse files
feat(examples): dataset members carry a business description and its bundle translations (#34953)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34873 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:app-todo 与 app-showcase 的全部 39 个数据集成员(维度与度量)各加一句业务 `description`,并在各应用已有的非英文语言包里补上对应译文(app-todo:zh-CN、ja-JP;app-showcase:zh-CN)。 - **为什么改**:示例是作者照抄的样板;此前成员只有 `synonyms`,抄过去只学到一半词汇。现在与 app-crm 的写法一致。 - **风险与回滚**:仅示例元数据与译文、外加两处示例测试,不发布任何包;回滚即 revert 本 PR。 - **先看**:`examples/app-showcase/src/ui/datasets/revenue-pulse.dataset.ts`(`total_home_sum` 与 `revenue_sum` 的业务口径)、`examples/app-todo/src/datasets/task.dataset.ts`、`examples/app-showcase/src/system/translations/index.ts` 的 zh-CN `datasets` 段。 - **两分钟验证**:`pnpm check:i18n-coverage`,预期输出 `OK (14 config(s), 423 baselined untranslated string(s), none new)`。 - **需要你做的**:无,席位落地。 ## What changes - **`examples/app-todo/src/datasets/task.dataset.ts`**: all 9 members (6 dimensions, 3 measures) of `todo_task_metrics` gain a one-sentence business `description`, in the pattern of `examples/app-crm/src/datasets/opportunity.dataset.ts` (a plain business definition, not an instruction to a model). - **`examples/app-showcase/src/ui/datasets/{chart-gallery,revenue-pulse}.dataset.ts`**: all 30 members of `showcase_task_metrics` (10), `showcase_project_metrics` (6), `showcase_invoice_metrics` (8) and `showcase_account_metrics` (6) gain the same. The one-line member literals that now carry a description are unfolded to one key group per line. - **Bundle translations**, at the key the i18n walk and resolver read, `datasets.NAME.{dimensions,measures}.MEMBER.description` (verified in `packages/lint/src/i18n-walk.ts` and the spec's `datasets` translation schema; the same shape app-crm uses), in every non-source locale each app already carries: app-todo `zh-CN.ts` and `ja-JP.ts` (18 entries), app-showcase `zh-CN` (30 entries, merged into the existing `datasets` block beside its labels). Hand-written translations, terms aligned with each bundle's existing field and option labels. `en` gets no entry: it is the source locale, read from the dataset itself, and app-crm carries none either. - **Pins** (into the existing harness files, as top-level `describe`s): `examples/app-todo/src/translations/translation-completeness.test.ts` asserts each member declares a description and that zh-CN and ja-JP carry a translated one that is not the English; `examples/app-showcase/test/zh-cn-chart-gallery-measure-labels.test.ts` runs the app's four datasets through `translateMetadataDocument` and asserts every member authors a description and is served a Chinese one under zh-CN. ## Tests All readings at head `a7d31949`. - **i18n-coverage baseline: unchanged, 106 → 106 (app-todo) and 317 → 317 (app-showcase).** `pnpm check:i18n-coverage` exit 0: `OK (14 config(s), 423 baselined untranslated string(s), none new)`. The card's estimate of 106 → 124 is the count with the descriptions authored but *untranslated* (9 members × 2 locales = 18); each new description is translated in every non-source locale here, so the ratchet does not move and `scripts/i18n-coverage-baseline.json` is not edited. Control leg (to show the gate actually sees description keys): with the 9 zh-CN descriptions removed from app-todo, `os lint --json` reports `datasets.todo_task_metrics.*.description` missing for zh-CN; restored from `HEAD` (hash matches the HEAD blob, `git diff HEAD` empty). At head, `os lint --json` reports zero dataset `description` findings for either app. The remaining dataset findings are the pre-existing untranslated member *labels* (18 in app-todo, 25 in app-showcase), already in the frozen baseline. - `pnpm --filter @objectstack/example-todo validate` / `typecheck` / `test`: exit 0 / 0 / 0 (Test Files 9/9, Tests 267/267). - `pnpm --filter @objectstack/example-showcase validate` / `typecheck` / `test`: exit 0 / 0 / 0 (Test Files 48/48, Tests 549/549). `Validation passed`. Neither app's validate prints any `dataset-member-no-vocabulary` or other dataset finding. - `eslint --no-inline-config` on the 8 changed files: exit 0. <details><summary>Ablation of the two new pins (one per pin, via scripts/ablation-replace.mjs; restored to HEAD and verified)</summary> - Showcase: deleted the zh-CN `paid_count` description line. Result: `1 failed | 5 passed (6)`, `showcase_invoice_metrics.paid_count serves no zh-CN description`. Restored: `blob == HEAD (bf9a9f1) and git diff HEAD is empty`. - Todo: replaced the ja-JP `priority` description with the English text. Result: `1 failed | 92 passed (93)`, the not-the-English assertion. Restored: `blob == HEAD (495ea54) and git diff HEAD is empty`. - No rebuild needed: both suites import the example sources by relative path; the only dist import (`@objectstack/spec`) is untouched by the diff. </details> ## Acceptance notes - **Changeset: none, and `skip-changeset` is requested on create.** Both `@objectstack/example-todo` and `@objectstack/example-showcase` are `private: true`; the diff publishes nothing from any released package (the private-package fast lane). - The dataset member **labels** in both apps stay untranslated in zh-CN/ja-JP, as before; they are pre-existing baselined debt (the showcase bundle's own comment says so) and out of this card's scope, which is the description entries. - The descriptions state each member's business scope (for example, that counts and sums cover every status, that `total_home_sum` is converted into the home currency, and that `revenue_sum` is each account company's own annual revenue, not what it is billed). They introduce no number or rule that the metadata does not already carry. ## Verification <details><summary>Derived gate families (dispatch-gates --commands, 42 families), run locally at a7d3194</summary> - 41 exit 0, including `check:i18n-coverage`, `check:nul-bytes`, `check:examples-live-imports`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:type-check-coverage`, `check:type-check-debt`, `check:published-files`. - NOT MEASURED: `check:dual-build-cjs-loads`, reason: exit 3 `PREREQUISITE NOT MET` (it reads every package's built `dist/`, and only the CLI and the two examples' closures were built here). CI runs it on this PR. - `dispatch-gates --ran` reconciliation: `42 derived, 41 run, 1 NOT-MEASURED, 0 UNRUN`, derived from the recorded exit codes. </details> <details><summary>overlap-check</summary> `overlap-check: ... changes 8 file(s); against origin/main (c81f498) and 0 PR head(s)` · `origin/main: merges cleanly` · `VERDICT clean exit 0`. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzg1NmbJpZhtiWQkTir)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzg1NmbJpZhtiWQkTir --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0465f4a commit 02a290f

8 files changed

Lines changed: 259 additions & 26 deletions

File tree

‎examples/app-showcase/src/system/translations/index.ts‎

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,18 +1291,67 @@ export const ShowcaseTranslationBundle = {
12911291
// the three the Chart Gallery shows as KPI subtitles: 任务数 matches
12921292
// showcase_project's `task_count` column, 总预算 the `kpi_total_budget`
12931293
// widget and the command center's `cc_k6`.
1294+
//
1295+
// Every member's `description` is its business definition (ADR-0149 D1),
1296+
// translated at birth beside the authored English on the dataset; the
1297+
// `synonyms` are not here, they are matched in every language at once.
12941298
datasets: {
12951299
showcase_task_metrics: {
1300+
dimensions: {
1301+
status: { description: '任务在交付看板上所处的状态:待规划、待办、进行中、评审中或已完成。' },
1302+
priority: { description: '任务的紧急程度:低、中、高或紧急。' },
1303+
progress: { description: '任务的完成程度,即任务上填写的 0 到 100 的百分比。' },
1304+
created_at: { description: '任务的创建日期,按自然月归组。' },
1305+
},
12961306
measures: {
1297-
task_count: { label: '任务数' },
1298-
done_count: { label: '已完成任务' },
1299-
done_rate: { label: '完成率' },
1307+
task_count: { label: '任务数', description: '任务的个数,涵盖从待规划到已完成的所有状态。' },
1308+
est_hours: { description: '各任务预计工时的合计;未填写预计工时的任务不计入。' },
1309+
avg_estimate: { description: '单个任务的平均预计工时;未填写预计工时的任务不参与平均。' },
1310+
avg_progress: { description: '各任务的平均进度,以 0 到 100 的百分点表示。' },
1311+
done_count: { label: '已完成任务', description: '处于已完成状态的任务个数。' },
1312+
done_rate: { label: '完成率', description: '已完成任务所占的比例:已完成任务数除以任务数,以百分比显示。' },
13001313
},
13011314
},
13021315
showcase_project_metrics: {
1316+
dimensions: {
1317+
account: { description: '项目所服务的客户公司;结果显示客户名称。' },
1318+
status: { description: '项目所处的状态:计划中、进行中、已暂停、已完成或已取消。' },
1319+
health: { description: '项目报告的健康度:绿色表示进展正常,黄色表示需要关注,红色表示存在风险。' },
1320+
},
1321+
measures: {
1322+
project_count: { label: '项目数', description: '项目的个数,涵盖所有状态:已完成和已取消的项目也计入。' },
1323+
budget_sum: { label: '总预算', description: '各项目计划预算的合计,涵盖所有状态。' },
1324+
spent_sum: { description: '各项目迄今已花费金额的合计,涵盖所有状态;与总预算对照可看出预算已用了多少。' },
1325+
},
1326+
},
1327+
showcase_invoice_metrics: {
1328+
dimensions: {
1329+
status: { description: '发票所处的状态:草稿、已发送、已付款或已作废。' },
1330+
region: { description: '发票所属的开票区域:美洲、欧洲、中东和非洲,或亚太。' },
1331+
issued_on: { description: '发票的开具日期,按自然月归组。' },
1332+
account: { description: '发票开给的客户公司;结果显示客户名称。' },
1333+
},
13031334
measures: {
1304-
project_count: { label: '项目数' },
1305-
budget_sum: { label: '总预算' },
1335+
invoice_count: { description: '发票的张数,涵盖所有状态:草稿和已作废的发票也计入。' },
1336+
total_home_sum: {
1337+
description: '所有状态发票的含税总额,每张都折算为组织的本位币,因此以不同币种开具的发票可以相加。',
1338+
},
1339+
paid_count: { description: '处于已付款状态的发票张数。' },
1340+
paid_rate: { description: '已付款发票所占的比例:已付款发票数除以发票数,以百分比显示。' },
1341+
},
1342+
},
1343+
showcase_account_metrics: {
1344+
dimensions: {
1345+
industry: { description: '客户公司所在的行业:科技、金融、医疗或零售。' },
1346+
status: { description: '客户在生命周期中所处的阶段:潜在客户、活跃客户或已流失。' },
1347+
sales_region: { description: '负责该客户的销售区域:美洲、欧洲、中东和非洲,或亚太。' },
1348+
signed_on: { description: '公司成为客户的日期,按自然月归组。' },
1349+
},
1350+
measures: {
1351+
account_count: { description: '客户的个数:潜在客户和已流失的客户也计入。' },
1352+
revenue_sum: {
1353+
description: '各客户公司年收入的合计,潜在客户和已流失的客户也计入;这是每家公司自身的年营收,而不是向它开票的金额。',
1354+
},
13061355
},
13071356
},
13081357
},

‎examples/app-showcase/src/ui/datasets/chart-gallery.dataset.ts‎

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,51 @@ export const ShowcaseTaskDataset = defineDataset({
1313
name: 'showcase_task_metrics',
1414
label: 'Task Metrics',
1515
object: 'showcase_task',
16-
// Every member carries `synonyms` (ADR-0149 D1): the words a person types in
17-
// a question, every language in the one list; matched, never translated.
16+
// Every member carries its ADR-0149 D1 business vocabulary: `synonyms`, the
17+
// words a person types in a question, every language in the one list
18+
// (matched, never translated), and `description`, a plain business
19+
// definition, translated at `datasets.<name>.{dimensions,measures}.<member>.description`.
1820
dimensions: [
19-
{ name: 'status', label: 'Status', field: 'status', type: 'string', synonyms: ['task status', '任务状态'] },
20-
{ name: 'priority', label: 'Priority', field: 'priority', type: 'string', synonyms: ['urgency', '优先级'] },
21+
{
22+
name: 'status', label: 'Status', field: 'status', type: 'string',
23+
description: 'Where the task stands on the delivery board: Backlog, To Do, In Progress, In Review or Done.',
24+
synonyms: ['task status', '任务状态'],
25+
},
26+
{
27+
name: 'priority', label: 'Priority', field: 'priority', type: 'string',
28+
description: 'How urgent the task is: Low, Medium, High or Urgent.',
29+
synonyms: ['urgency', '优先级'],
30+
},
2131
{
2232
name: 'progress', label: 'Progress', field: 'progress', type: 'number',
33+
description: 'How far along the task is, as a percentage from 0 to 100 entered on the task.',
2334
synonyms: ['percent complete', 'completion percentage', '进度'],
2435
},
2536
{
2637
name: 'created_at', label: 'Created', field: 'created_at', type: 'date', dateGranularity: 'month',
38+
description: 'The date the task was created, grouped by calendar month.',
2739
synonyms: ['created date', 'creation month', '创建时间', '创建月份'],
2840
},
2941
],
3042
measures: [
31-
{ name: 'task_count', label: 'Tasks', aggregate: 'count', synonyms: ['number of tasks', '任务数', '任务数量'] },
43+
{
44+
name: 'task_count', label: 'Tasks', aggregate: 'count',
45+
description: 'How many tasks there are, at every status from Backlog to Done.',
46+
synonyms: ['number of tasks', '任务数', '任务数量'],
47+
},
3248
{
3349
name: 'est_hours', label: 'Estimated Hours', aggregate: 'sum', field: 'estimate_hours', format: '0.0',
50+
description: 'The sum of the estimated hours of the tasks; a task with no estimate adds nothing.',
3451
synonyms: ['planned hours', 'estimated effort', '预估工时'],
3552
},
3653
{
3754
name: 'avg_estimate', label: 'Avg Estimate', aggregate: 'avg', field: 'estimate_hours', format: '0.0',
55+
description: 'The average estimated hours of one task; tasks with no estimate are left out of the average.',
3856
synonyms: ['average estimate', 'average estimated hours', '平均预估工时'],
3957
},
4058
{
4159
name: 'avg_progress', label: 'Avg Progress', aggregate: 'avg', field: 'progress', format: '0.0',
60+
description: 'The average progress of the tasks, in percentage points from 0 to 100.',
4261
synonyms: ['average progress', 'average completion', '平均进度'],
4362
},
4463
// The done rate, moved here from the `showcase_delivery` cube (#20943): a
@@ -50,13 +69,15 @@ export const ShowcaseTaskDataset = defineDataset({
5069
// scale from the operator, as it does for `paid_rate`.
5170
{
5271
name: 'done_count', label: 'Done Tasks', aggregate: 'count', filter: { status: 'done' },
72+
description: 'How many tasks are in the Done status.',
5373
synonyms: ['completed tasks', 'finished tasks', '已完成任务数'],
5474
},
5575
{
5676
name: 'done_rate',
5777
label: 'Done Rate',
5878
derived: { op: 'ratio', of: ['done_count', 'task_count'] },
5979
format: '0.0%',
80+
description: 'The share of tasks that are Done: Done Tasks divided by Tasks, shown as a percentage.',
6081
synonyms: ['completion rate', 'percent done', '完成率'],
6182
},
6283
],
@@ -67,18 +88,33 @@ export const ShowcaseProjectDataset = defineDataset({
6788
name: 'showcase_project_metrics',
6889
label: 'Project Metrics',
6990
object: 'showcase_project',
70-
// Every member carries `synonyms` (ADR-0149 D1): the words a person types in
71-
// a question, every language in the one list; matched, never translated.
91+
// Every member carries its ADR-0149 D1 business vocabulary: `synonyms`, the
92+
// words a person types in a question, every language in the one list
93+
// (matched, never translated), and `description`, a plain business
94+
// definition, translated at `datasets.<name>.{dimensions,measures}.<member>.description`.
7295
dimensions: [
73-
{ name: 'account', label: 'Account', field: 'account', type: 'lookup', synonyms: ['customer', 'client', '客户'] },
96+
{
97+
name: 'account', label: 'Account', field: 'account', type: 'lookup',
98+
description: 'The customer company the project is delivered for; results show the account name.',
99+
synonyms: ['customer', 'client', '客户'],
100+
},
74101
// status / health added for the Operations dashboard — power the
75102
// "by health" chart and the filtered KPI tiles (active / at-risk).
76-
{ name: 'status', label: 'Status', field: 'status', type: 'string', synonyms: ['project status', '项目状态'] },
77-
{ name: 'health', label: 'Health', field: 'health', type: 'string', synonyms: ['project health', '项目健康度'] },
103+
{
104+
name: 'status', label: 'Status', field: 'status', type: 'string',
105+
description: 'Where the project stands: Planned, Active, On Hold, Completed or Cancelled.',
106+
synonyms: ['project status', '项目状态'],
107+
},
108+
{
109+
name: 'health', label: 'Health', field: 'health', type: 'string',
110+
description: 'The health the project reports: Green is on track, Yellow needs attention and Red is at risk.',
111+
synonyms: ['project health', '项目健康度'],
112+
},
78113
],
79114
measures: [
80115
{
81116
name: 'project_count', label: 'Projects', aggregate: 'count',
117+
description: 'How many projects there are, at every status: completed and cancelled projects are counted too.',
82118
synonyms: ['number of projects', '项目数', '项目数量'],
83119
},
84120
// `budget`/`spent` are currency fields with a FIXED currency
@@ -93,10 +129,14 @@ export const ShowcaseProjectDataset = defineDataset({
93129
// currency, so both dashboards read one total budget alike.
94130
{
95131
name: 'budget_sum', label: 'Total Budget', aggregate: 'sum', field: 'budget', format: '0,0.00',
132+
description: 'The sum of the planned Budget of the projects, at every status.',
96133
synonyms: ['budget', 'planned budget', '预算', '总预算'],
97134
},
98135
{
99136
name: 'spent_sum', label: 'Total Spent', aggregate: 'sum', field: 'spent', format: '0,0.00',
137+
description:
138+
'The sum of what has been Spent on the projects so far, at every status; set it beside Total Budget '
139+
+ 'to see how much of the budget is used.',
100140
synonyms: ['spend', 'actual spend', '支出', '已花费'],
101141
},
102142
],

‎examples/app-showcase/src/ui/datasets/revenue-pulse.dataset.ts‎

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,36 @@ export const ShowcaseInvoiceDataset = defineDataset({
1515
name: 'showcase_invoice_metrics',
1616
label: 'Invoice Metrics',
1717
object: 'showcase_invoice',
18-
// Every member carries `synonyms` (ADR-0149 D1): the words a person types in
19-
// a question, every language in the one list; matched, never translated.
18+
// Every member carries its ADR-0149 D1 business vocabulary: `synonyms`, the
19+
// words a person types in a question, every language in the one list
20+
// (matched, never translated), and `description`, a plain business
21+
// definition, translated at `datasets.<name>.{dimensions,measures}.<member>.description`.
2022
dimensions: [
21-
{ name: 'status', label: 'Status', field: 'status', type: 'string', synonyms: ['invoice status', '发票状态'] },
22-
{ name: 'region', label: 'Region', field: 'region', type: 'string', synonyms: ['billing region', '区域', '地区'] },
23+
{
24+
name: 'status', label: 'Status', field: 'status', type: 'string',
25+
description: 'Where the invoice stands: Draft, Sent, Paid or Void.',
26+
synonyms: ['invoice status', '发票状态'],
27+
},
28+
{
29+
name: 'region', label: 'Region', field: 'region', type: 'string',
30+
description: 'The billing region the invoice belongs to: AMER, EMEA or APAC.',
31+
synonyms: ['billing region', '区域', '地区'],
32+
},
2333
{
2434
name: 'issued_on', label: 'Issued', field: 'issued_on', type: 'date', dateGranularity: 'month',
35+
description: 'The date the invoice was issued, grouped by calendar month.',
2536
synonyms: ['issue date', 'invoice month', '开票日期', '开票月份'],
2637
},
27-
{ name: 'account', label: 'Account', field: 'account', type: 'lookup', synonyms: ['customer', 'client', '客户'] },
38+
{
39+
name: 'account', label: 'Account', field: 'account', type: 'lookup',
40+
description: 'The customer company the invoice is billed to; results show the account name.',
41+
synonyms: ['customer', 'client', '客户'],
42+
},
2843
],
2944
measures: [
3045
{
3146
name: 'invoice_count', label: 'Invoices', aggregate: 'count',
47+
description: 'How many invoices there are, at every status: drafts and void invoices are counted too.',
3248
synonyms: ['number of invoices', '发票数', '发票数量'],
3349
},
3450
// Invoices bill in different currencies (`showcase_invoice.currency_code`),
@@ -38,6 +54,9 @@ export const ShowcaseInvoiceDataset = defineDataset({
3854
// organization's, whatever each invoice was billed in.
3955
{
4056
name: 'total_home_sum', label: 'Total incl. Tax (Home Currency)', aggregate: 'sum', field: 'amount_home', format: '0,0',
57+
description:
58+
'The tax-inclusive total of the invoices at every status, each converted into the organization\'s home '
59+
+ 'currency so that invoices billed in different currencies add up.',
4160
synonyms: ['invoiced amount', 'billed amount', '开票金额', '含税总额'],
4261
},
4362
// A RATE — the percent-scale case (objectui#3136). `paid_rate` is a 0–1
@@ -47,13 +66,15 @@ export const ShowcaseInvoiceDataset = defineDataset({
4766
// `ratio` operator, so display no longer has to infer it.
4867
{
4968
name: 'paid_count', label: 'Paid Invoices', aggregate: 'count', filter: { status: 'paid' },
69+
description: 'How many invoices are in the Paid status.',
5070
synonyms: ['invoices paid', 'settled invoices', '已付发票数'],
5171
},
5272
{
5373
name: 'paid_rate',
5474
label: 'Paid Rate',
5575
derived: { op: 'ratio', of: ['paid_count', 'invoice_count'] },
5676
format: '0.0%',
77+
description: 'The share of invoices that are Paid: Paid Invoices divided by Invoices, shown as a percentage.',
5778
synonyms: ['payment rate', 'share of invoices paid', '付款率'],
5879
},
5980
],
@@ -64,30 +85,43 @@ export const ShowcaseAccountDataset = defineDataset({
6485
name: 'showcase_account_metrics',
6586
label: 'Account Metrics',
6687
object: 'showcase_account',
67-
// Every member carries `synonyms` (ADR-0149 D1): the words a person types in
68-
// a question, every language in the one list; matched, never translated.
88+
// Every member carries its ADR-0149 D1 business vocabulary: `synonyms`, the
89+
// words a person types in a question, every language in the one list
90+
// (matched, never translated), and `description`, a plain business
91+
// definition, translated at `datasets.<name>.{dimensions,measures}.<member>.description`.
6992
dimensions: [
70-
{ name: 'industry', label: 'Industry', field: 'industry', type: 'string', synonyms: ['sector', 'vertical', '行业'] },
93+
{
94+
name: 'industry', label: 'Industry', field: 'industry', type: 'string',
95+
description: 'The industry the customer company works in: Technology, Finance, Healthcare or Retail.',
96+
synonyms: ['sector', 'vertical', '行业'],
97+
},
7198
{
7299
name: 'status', label: 'Lifecycle', field: 'status', type: 'string',
100+
description: 'Where the account stands as a customer: Prospect, Active or Churned.',
73101
synonyms: ['account status', 'lifecycle stage', '客户状态', '生命周期'],
74102
},
75103
{
76104
name: 'sales_region', label: 'Sales Region', field: 'sales_region', type: 'string',
105+
description: 'The sales territory that owns the account: AMER, EMEA or APAC.',
77106
synonyms: ['territory', 'sales territory', '销售区域'],
78107
},
79108
{
80109
name: 'signed_on', label: 'Customer Since', field: 'signed_on', type: 'date', dateGranularity: 'month',
110+
description: 'The date the company became a customer, grouped by calendar month.',
81111
synonyms: ['signing date', 'signed date', '签约日期', '签约月份'],
82112
},
83113
],
84114
measures: [
85115
{
86116
name: 'account_count', label: 'Accounts', aggregate: 'count',
117+
description: 'How many accounts there are: prospects and churned customers are counted too.',
87118
synonyms: ['number of accounts', 'customer count', '客户数', '客户数量'],
88119
},
89120
{
90121
name: 'revenue_sum', label: 'Annual Revenue', aggregate: 'sum', field: 'annual_revenue', format: '0,0',
122+
description:
123+
'The sum of the Annual Revenue of the account companies, prospects and churned customers included; '
124+
+ 'it is each company\'s own yearly revenue, not what it is billed.',
91125
synonyms: ['revenue', 'yearly revenue', '年营收', '年收入'],
92126
},
93127
],

‎examples/app-showcase/test/zh-cn-chart-gallery-measure-labels.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import { describe, expect, it } from 'vitest';
1313
import { translateMetadataDocument, type TranslationBundle } from '@objectstack/spec/system';
1414
import { ShowcaseProjectDataset, ShowcaseTaskDataset } from '../src/ui/datasets/chart-gallery.dataset.js';
15+
import { ShowcaseAccountDataset, ShowcaseInvoiceDataset } from '../src/ui/datasets/revenue-pulse.dataset.js';
1516
import { ShowcaseTranslationBundle } from '../src/system/translations/index.js';
1617

1718
const bundle = ShowcaseTranslationBundle as unknown as TranslationBundle;
@@ -39,3 +40,25 @@ describe('showcase Chart Gallery — KPI measure labels per locale', () => {
3940
.toEqual({ project_count: 'Projects', budget_sum: 'Total Budget' });
4041
});
4142
});
43+
44+
// Every member of the app's four datasets carries a business `description`
45+
// (ADR-0149 D1), and the same translator serves it in Chinese under zh-CN.
46+
// `check:i18n-coverage` holds the translated half as a count; this names the
47+
// member that lost either half.
48+
describe('showcase datasets — every member description, authored and served per locale', () => {
49+
const datasets = [ShowcaseTaskDataset, ShowcaseProjectDataset, ShowcaseInvoiceDataset, ShowcaseAccountDataset];
50+
type Member = { name: string; description?: unknown };
51+
const members = (doc: unknown): Member[] => {
52+
const d = doc as { dimensions?: Member[]; measures?: Member[] };
53+
return [...(d.dimensions ?? []), ...(d.measures ?? [])];
54+
};
55+
56+
it.each(datasets.map((ds) => [ds.name, ds] as const))('%s', (_name, ds) => {
57+
const zh = members(translateMetadataDocument('dataset', ds, bundle, { locale: 'zh-CN' }));
58+
for (const member of members(ds)) {
59+
expect(typeof member.description, `${ds.name}.${member.name} has no description`).toBe('string');
60+
const served = zh.find((m) => m.name === member.name)?.description;
61+
expect(served, `${ds.name}.${member.name} serves no zh-CN description`).toMatch(/[一-鿿]/);
62+
}
63+
});
64+
});

0 commit comments

Comments
 (0)