Skip to content

Commit 1f5811f

Browse files
committed
wip(examples): zh-CN / ja-JP report translations and the changeset
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUeRMD4VYCYUfzxTKcZFAF
1 parent f6725a9 commit 1f5811f

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/cli': minor
4+
'@objectstack/lint': minor
5+
'@objectstack/metadata-protocol': minor
6+
'@objectstack/rest': minor
7+
---
8+
9+
feat(spec,cli): reports are translatable — `reports.<name>` in the translation bundle
10+
11+
Clause-②: yes
12+
Metadata-protocol: added
13+
14+
An app authored in one language listed its reports (`reports[].label`, `reports[].description`) in that language on the app's report index and the report page heading. Before this change the translation bundle had no key for them: `reports` was a retired object-first dialect key, so a bundle carrying it was refused by `os validate`, and `os i18n check` could not report the gap.
15+
16+
- **`@objectstack/spec`:** `TranslationData` (and the registered `translation` item and the platform bundle, which share its groups) gains `reports`, keyed by the report's `name`, carrying `label` and `description` (strict: any other key is refused — `name` or `title` with a message pointing at `label`, and the singular spelling `report` with a message pointing at `reports`). `reports` leaves `LEGACY_OBJECT_FIRST_KEYS`, so a stored translation row carrying it now loads through the authored-row sync instead of being skipped as a retired dialect; the legacy dialect never used the key. A new translator, `translateReport`, overlays the two strings and is registered in the metadata-document dispatch, so `GET /meta/report` (list and item) is served in the request's locale. A key the bundle does not carry keeps the authored string. A report is overlay-editable (ADR-0126 Regime O), so the translator honours the packaged base: a label or description an org re-authored is served as written (ADR-0029 D9.2a), and the strings it did not touch are still translated.
17+
- **`@objectstack/metadata-protocol`:** `getPackagedReportBase(name)` returns the shipped report document beneath any overlay, the base the REST read path hands the translator.
18+
- **`@objectstack/rest`:** the meta read path supplies that base for `report`, as it does for `dashboard` and `view`.
19+
- **`@objectstack/lint`:** `translation-target-unknown` reports a `reports.<name>` key that names no report a package of the stack declares, as an error with the nearest declared name.
20+
- **`@objectstack/cli`:** `os i18n extract` scaffolds `reports.<name>.label` / `.description` from the stack's `reports[]`, and `os i18n check` / `os lint` coverage report an untranslated one in its own bucket (`i18n/missing-report`).
21+
22+
Example (`zh-CN` bundle of an English-authored app):
23+
24+
```ts
25+
reports: { opps_by_stage: { label: '各阶段商机', description: '按阶段汇总的商机' } },
26+
```

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,5 +1337,13 @@ export const ShowcaseTranslationBundle = {
13371337
showcase_field_ops_delegate: { label: '现场运营委派管理员' },
13381338
showcase_client_liaison: { label: '示例客户联络人' },
13391339
},
1340+
// The reports, as the report index lists them and each report page is
1341+
// headed. Counted by `check-i18n-coverage` like the groups above.
1342+
reports: {
1343+
showcase_hours_by_status: { label: '按状态统计工时(汇总)', description: '按任务状态分组的预计工时。' },
1344+
showcase_status_priority_matrix: { label: '状态 × 优先级(矩阵)', description: '按状态和优先级交叉统计的预计工时。' },
1345+
showcase_task_overview: { label: '任务概览(联合)', description: '将多个任务子报表堆叠在一个联合视图中。' },
1346+
showcase_hours_by_status_chart: { label: '按状态统计工时(图表)', description: '以柱状图展示按状态统计的预计工时。' },
1347+
},
13401348
},
13411349
};

‎examples/app-todo/src/translations/ja-JP.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ export const jaJP: TranslationData = {
9191
description: '個人タスク管理アプリケーション',
9292
},
9393
},
94+
// The app's reports, as its report index lists them and each report page is
95+
// headed (`reports.<name>.label` / `.description`).
96+
reports: {
97+
tasks_by_status: { label: 'ステータス別タスク', description: 'ステータス別に集計したタスク' },
98+
tasks_by_priority: { label: '優先度別タスク', description: '優先度レベル別に集計したタスク' },
99+
tasks_by_owner: { label: '担当者別タスク', description: '担当者別のタスク集計' },
100+
completed_tasks: { label: '完了済みタスク', description: '作業時間の記録付きの完了済みタスク' },
101+
time_tracking: { label: '作業時間レポート', description: '見積時間と実績時間の分析' },
102+
},
94103
// The quick-add wizard: the flow's name in the runner header and completion
95104
// toast, each screen's heading and each field label.
96105
flows: {

‎examples/app-todo/src/translations/zh-CN.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ export const zhCN: TranslationData = {
9999
description: '个人任务管理应用',
100100
},
101101
},
102+
// The app's reports, as its report index lists them and each report page is
103+
// headed (`reports.<name>.label` / `.description`).
104+
reports: {
105+
tasks_by_status: { label: '按状态统计任务', description: '按状态分组的任务汇总' },
106+
tasks_by_priority: { label: '按优先级统计任务', description: '按优先级分组的任务汇总' },
107+
tasks_by_owner: { label: '按负责人统计任务', description: '按负责人汇总的任务' },
108+
completed_tasks: { label: '已完成任务', description: '所有已完成任务及其工时记录' },
109+
time_tracking: { label: '工时跟踪报表', description: '预计工时与实际工时分析' },
110+
},
102111
// The quick-add wizard: the flow's name in the runner header and completion
103112
// toast, each screen's heading and each field label.
104113
flows: {

0 commit comments

Comments
 (0)