Skip to content

Commit da49afe

Browse files
committed
feat(ui): the translation preview and the console loader know the reports group
objectui is now this repository's ui/ workspace, so the consumer half filed as objectui#13543 lands with the spec change: a reports row in the translation designer's CATEGORY_DEFS (en/zh heading keys), 'reports' in SPEC_TRANSLATION_GROUPS, and the two tests that pin both lists. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUeRMD4VYCYUfzxTKcZFAF
1 parent bbb49e3 commit da49afe

6 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎.changeset/25788-translation-reports.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
'@objectstack/lint': minor
55
'@objectstack/metadata-protocol': minor
66
'@objectstack/rest': minor
7+
'@object-ui/app-shell': minor
8+
'@object-ui/i18n': minor
79
---
810

911
feat(spec,cli): reports are translatable — `reports.<name>` in the translation bundle
@@ -18,6 +20,7 @@ An app authored in one language listed its reports (`reports[].label`, `reports[
1820
- **`@objectstack/rest`:** the meta read path supplies that base for `report`, as it does for `dashboard` and `view`.
1921
- **`@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.
2022
- **`@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`).
23+
- **`@object-ui/app-shell`, `@object-ui/i18n`:** the translation designer's preview draws the `reports` group (a "Reports" / 「报表」 category beside the others), and the console's translation loader recognises a payload that carries only `reports`.
2124

2225
Example (`zh-CN` bundle of an English-authored app):
2326

‎ui/packages/app-shell/src/views/metadata-admin/i18n.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,7 @@ const ENGINE_STRINGS_EN: Record<string, string> = {
18411841
'engine.translationPreview.category.globalActions': 'Global Actions',
18421842
'engine.translationPreview.category.dashboards': 'Dashboards',
18431843
'engine.translationPreview.category.datasets': 'Datasets',
1844+
'engine.translationPreview.category.reports': 'Reports',
18441845
'engine.translationPreview.category.pages': 'Pages',
18451846
'engine.translationPreview.category.flows': 'Flows',
18461847
'engine.translationPreview.category.positions': 'Positions',
@@ -5522,6 +5523,7 @@ const ENGINE_STRINGS_ZH: Record<string, string> = {
55225523
'engine.translationPreview.category.globalActions': '全局操作',
55235524
'engine.translationPreview.category.dashboards': '仪表盘',
55245525
'engine.translationPreview.category.datasets': '数据集',
5526+
'engine.translationPreview.category.reports': '报表',
55255527
'engine.translationPreview.category.pages': '页面',
55265528
'engine.translationPreview.category.flows': '流程',
55275529
'engine.translationPreview.category.positions': '岗位',

‎ui/packages/app-shell/src/views/metadata-admin/previews/TranslationPreview.categories-11765.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ const ONE_ENTRY: Record<string, { data: Record<string, unknown>; key: string; ro
5656
key: 'revenue',
5757
row: () => keys(2),
5858
},
59+
reports: {
60+
data: { opps_by_stage: { label: 'Opportunités par étape', description: 'Opportunités regroupées par étape' } },
61+
key: 'opps_by_stage',
62+
row: () => keys(2),
63+
},
5964
pages: { data: { home: { label: 'Accueil' } }, key: 'home', row: () => keys(1) },
6065
flows: { data: { onboarding: { label: 'Intégration' } }, key: 'onboarding', row: () => keys(1) },
6166
positions: { data: { legal_counsel: { label: 'Conseiller juridique' } }, key: 'legal_counsel', row: () => keys(1) },

‎ui/packages/app-shell/src/views/metadata-admin/previews/TranslationPreview.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import * as React from 'react';
3333
import {
3434
AppWindow,
35+
BarChart3,
3536
ClipboardList,
3637
Database,
3738
FileText,
@@ -94,6 +95,7 @@ const CATEGORY_DEFS = {
9495
},
9596
dashboards: { label: 'engine.translationPreview.category.dashboards', icon: LayoutDashboard, flat: false },
9697
datasets: { label: 'engine.translationPreview.category.datasets', icon: Database, flat: false },
98+
reports: { label: 'engine.translationPreview.category.reports', icon: BarChart3, flat: false },
9799
pages: { label: 'engine.translationPreview.category.pages', icon: PanelsTopLeft, flat: false },
98100
flows: { label: 'engine.translationPreview.category.flows', icon: Workflow, flat: false },
99101
positions: { label: 'engine.translationPreview.category.positions', icon: Users, flat: false },

‎ui/packages/app-shell/src/views/metadata-admin/previews/adminPreviews.i18n-10862-s2.test.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ describe('TranslationPreview reads the designer locale (objectui#10862)', () =>
459459
{ key: 'engine.translationPreview.category.globalActions' },
460460
{ key: 'engine.translationPreview.category.dashboards' },
461461
{ key: 'engine.translationPreview.category.datasets' },
462+
{ key: 'engine.translationPreview.category.reports' },
462463
{ key: 'engine.translationPreview.category.pages' },
463464
{ key: 'engine.translationPreview.category.flows' },
464465
{ key: 'engine.translationPreview.category.positions' },
@@ -470,7 +471,7 @@ describe('TranslationPreview reads the designer locale (objectui#10862)', () =>
470471
{ key: 'engine.translationPreview.keyCountOne', vars: { count: 1 } },
471472
]);
472473
// The bundle's own locale is author data, not the designer's language.
473-
expectAsWritten(['French', 'fr-FR', 'account', '"Un"', '2/13 (15%)']);
474+
expectAsWritten(['French', 'fr-FR', 'account', '"Un"', '2/14 (14%)']);
474475
});
475476
}
476477
});

‎ui/packages/i18n/src/utils/spec-translations.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ const SPEC_TRANSLATION_GROUPS = [
9494
// commit (objectui#13478), copied through onto `app` the same way.
9595
'positions',
9696
'permissions',
97+
// objectstack #25788 serves `reports` (a report's label and description are
98+
// translatable), copied through onto `app` the same way.
99+
'reports',
97100
] as const;
98101

99102
function isPlainObject(value: unknown): value is Record<string, unknown> {

0 commit comments

Comments
 (0)