Skip to content

Commit c3c8e42

Browse files
committed
fix(app-shell): the publish sheet names a batch of hooks or translations in words, not the raw type code
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZ2YeJynYaMx8rfBzM
1 parent 9afcd6a commit c3c8e42

14 files changed

Lines changed: 144 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(app-shell): the Studio publish sheet names a batch of hooks or translations in words ("3 hooks", zh 「钩子 3」) instead of the raw type code ("3 hook") (#29902)
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
- **`@object-ui/i18n`**: two new count families in every pack, `preview.changes.typeCount.hook` and `preview.changes.typeCount.translation`, with each CLDR slot the pack's language selects.
12+
- **`@object-ui/app-shell`**: the Pending changes / publish sheet's summary line and group headings read those families for `hook` (authored in an object's Hooks tab) and `translation` (authored in Studio's "All metadata" form editor). A type with no family still shows its raw name.

‎ui/packages/app-shell/src/preview/DraftChangesPanel.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,11 @@ const TYPE_COUNT: Readonly<Record<string, (t: Translate, count: number) => strin
870870
// A Studio-authored dataset publishes in the same batch as the report or
871871
// dashboard that reads it; without a row it read as the raw type name.
872872
dataset: (t, count) => t('preview.changes.typeCount.dataset', { count, defaultValue: '{{count}} datasets' }),
873+
// objectstack#29902 — Studio authors both of these itself: a hook from an
874+
// object's Hooks tab, a translation from the "All metadata" form editor.
875+
hook: (t, count) => t('preview.changes.typeCount.hook', { count, defaultValue: '{{count}} hooks' }),
876+
translation: (t, count) =>
877+
t('preview.changes.typeCount.translation', { count, defaultValue: '{{count}} translations' }),
873878
};
874879

875880
function summaryTypeSegment(t: Translate, type: string, count: number): string {

‎ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.groupHeading-13221.test.tsx‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,43 @@ describe('an object extension group reads its translated name (objectstack#29704
115115
expect(headingTexts(list)).toEqual(['2 object extensions']);
116116
});
117117
});
118+
119+
/*
120+
* objectstack#29902 — hooks (an object's Hooks tab) and translations (the
121+
* "All metadata" form editor) are types Studio authors itself, yet a batch of
122+
* three hooks read "3 items · 3 hook" (zh 「hook 3」): no count family, so the
123+
* raw-name fallback. Both now read their pack's own word.
124+
*/
125+
describe('a hook or translation group reads its translated name (objectstack#29902)', () => {
126+
const hooks = [
127+
{ type: 'hook', name: 'h_a' },
128+
{ type: 'hook', name: 'h_b' },
129+
{ type: 'hook', name: 'h_c' },
130+
];
131+
132+
it('en: three hooks head their group "3 hooks"', async () => {
133+
const list = await headingsFor(hooks);
134+
expect(headingTexts(list)).toEqual(['3 hooks']);
135+
});
136+
137+
it('zh: three hooks head their group 「钩子 3」', async () => {
138+
const list = await headingsFor(hooks, 'zh');
139+
await waitFor(() => expect(headingTexts(list)).toEqual(['钩子 3']));
140+
});
141+
142+
it('en: one translation heads its group "1 translation"', async () => {
143+
const list = await headingsFor([{ type: 'translation', name: 'zh-CN' }]);
144+
expect(headingTexts(list)).toEqual(['1 translation']);
145+
});
146+
147+
it('zh: two translations head their group 「翻译 2」', async () => {
148+
const list = await headingsFor(
149+
[
150+
{ type: 'translation', name: 'zh-CN' },
151+
{ type: 'translation', name: 'ja-JP' },
152+
],
153+
'zh',
154+
);
155+
await waitFor(() => expect(headingTexts(list)).toEqual(['翻译 2']));
156+
});
157+
});

‎ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.summaryPlural-13147.test.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ describe('Pending changes summary — each type agrees with its count (objectui#
9595
await waitFor(() => expect(summary).toHaveTextContent(/^2 项 · 流程 2$/));
9696
});
9797

98+
it('objectstack#29902: three hook drafts read "3 items · 3 hooks"', async () => {
99+
const summary = await summaryFor([
100+
{ type: 'hook', name: 'h_a' },
101+
{ type: 'hook', name: 'h_b' },
102+
{ type: 'hook', name: 'h_c' },
103+
]);
104+
expect(summary).toHaveTextContent(/^3 items · 3 hooks$/);
105+
});
106+
98107
it('CONTROL: a type with no count family keeps its raw name, unpluralised', async () => {
99108
const summary = await summaryFor([
100109
{ type: 'st_unknown_kind', name: 'u_a' },

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5077,6 +5077,20 @@ const ar = {
50775077
dataset_few: 'مجموعات بيانات {{count}}',
50785078
dataset_many: 'مجموعات بيانات {{count}}',
50795079
dataset_other: 'مجموعات بيانات {{count}}',
5080+
hook: 'خطافات {{count}}',
5081+
hook_zero: 'خطافات {{count}}',
5082+
hook_one: 'خطاف {{count}}',
5083+
hook_two: 'خطافات {{count}}',
5084+
hook_few: 'خطافات {{count}}',
5085+
hook_many: 'خطافات {{count}}',
5086+
hook_other: 'خطافات {{count}}',
5087+
translation: 'ترجمات {{count}}',
5088+
translation_zero: 'ترجمات {{count}}',
5089+
translation_one: 'ترجمة {{count}}',
5090+
translation_two: 'ترجمات {{count}}',
5091+
translation_few: 'ترجمات {{count}}',
5092+
translation_many: 'ترجمات {{count}}',
5093+
translation_other: 'ترجمات {{count}}',
50805094
},
50815095
// objectui#12929 — the unchecked choice under an added object field whose
50825096
// literal default the batch publish can write into the existing records.

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4608,6 +4608,12 @@ const de = {
46084608
dataset: '{{count}} Datensätze',
46094609
dataset_one: '{{count}} Datensatz',
46104610
dataset_other: '{{count}} Datensätze',
4611+
hook: '{{count}} Hooks',
4612+
hook_one: '{{count}} Hook',
4613+
hook_other: '{{count}} Hooks',
4614+
translation: '{{count}} Übersetzungen',
4615+
translation_one: '{{count}} Übersetzung',
4616+
translation_other: '{{count}} Übersetzungen',
46114617
},
46124618
// objectui#12929 — the unchecked choice under an added object field whose
46134619
// literal default the batch publish can write into the existing records.

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,6 +4070,12 @@ const en = {
40704070
dataset: '{{count}} datasets',
40714071
dataset_one: '{{count}} dataset',
40724072
dataset_other: '{{count}} datasets',
4073+
hook: '{{count}} hooks',
4074+
hook_one: '{{count}} hook',
4075+
hook_other: '{{count}} hooks',
4076+
translation: '{{count}} translations',
4077+
translation_one: '{{count}} translation',
4078+
translation_other: '{{count}} translations',
40734079
},
40744080
// objectui#12929 — the unchecked choice under an added object field whose
40754081
// literal default the batch publish can write into the existing records.

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4726,6 +4726,14 @@ const es = {
47264726
dataset_one: '{{count}} conjunto de datos',
47274727
dataset_many: '{{count}} de conjuntos de datos',
47284728
dataset_other: '{{count}} conjuntos de datos',
4729+
hook: '{{count}} hooks',
4730+
hook_one: '{{count}} hook',
4731+
hook_many: '{{count}} de hooks',
4732+
hook_other: '{{count}} hooks',
4733+
translation: '{{count}} traducciones',
4734+
translation_one: '{{count}} traducción',
4735+
translation_many: '{{count}} de traducciones',
4736+
translation_other: '{{count}} traducciones',
47294737
},
47304738
// objectui#12929 — the unchecked choice under an added object field whose
47314739
// literal default the batch publish can write into the existing records.

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4722,6 +4722,14 @@ const fr = {
47224722
dataset_one: '{{count}} jeu de données',
47234723
dataset_many: '{{count}} de jeux de données',
47244724
dataset_other: '{{count}} jeux de données',
4725+
hook: '{{count}} hooks',
4726+
hook_one: '{{count}} hook',
4727+
hook_many: '{{count}} de hooks',
4728+
hook_other: '{{count}} hooks',
4729+
translation: '{{count}} traductions',
4730+
translation_one: '{{count}} traduction',
4731+
translation_many: '{{count}} de traductions',
4732+
translation_other: '{{count}} traductions',
47254733
},
47264734
// objectui#12929 — the unchecked choice under an added object field whose
47274735
// literal default the batch publish can write into the existing records.

‎ui/packages/i18n/src/locales/ja.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4610,6 +4610,12 @@ const ja = {
46104610
dataset: 'データセット {{count}}',
46114611
dataset_one: 'データセット {{count}}',
46124612
dataset_other: 'データセット {{count}}',
4613+
hook: 'フック {{count}}',
4614+
hook_one: 'フック {{count}}',
4615+
hook_other: 'フック {{count}}',
4616+
translation: '翻訳 {{count}}',
4617+
translation_one: '翻訳 {{count}}',
4618+
translation_other: '翻訳 {{count}}',
46134619
},
46144620
// objectui#12929 — the unchecked choice under an added object field whose
46154621
// literal default the batch publish can write into the existing records.

0 commit comments

Comments
 (0)