Skip to content

Commit e8d9055

Browse files
committed
i18n(platform-objects): ship the platform objects, Setup, Studio and Account in zh-Hant
Adds the Traditional Chinese bundles for every sys_* object, the metadata configuration forms, the Setup / Studio / Account navigation, the System Overview dashboard and datasets, and the platform pages, registers them in the served bundles behind the source-hash fallback, and adds zh-Hant to the user and organization pages' inline copy. The extract config documents zh-Hant in --locales, so check:i18n gates the new bundles. Tests that list the shipped locales now include zh-Hant; the page parity shape test accepts a script subtag; the nav pins in plugin-approvals, plugin-security and service-settings hold zh-Hant to the same agreement. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cya5ej5GQV86RPbRPK
1 parent 33043bd commit e8d9055

36 files changed

Lines changed: 7216 additions & 55 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/platform-objects': patch
3+
---
4+
5+
i18n(platform-objects): the platform objects, Setup, Studio and Account ship in Traditional Chinese
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`@objectstack/platform-objects` now carries `zh-Hant` beside `en`, `zh-CN`, `ja-JP` and `es-ES`: every `sys_*` object (labels, fields, help, options, views, actions and their dialogs), the metadata-type configuration forms Studio opens, the Setup, Studio and Account navigation, the System Overview dashboard and its datasets, the platform pages' titles, and the inline copy on the user and organization record pages. An administrator or developer reading the platform in Traditional Chinese no longer sees it in English. The new bundles pass through the same source-hash fallback as the existing ones, and every hand-authored leaf records the digest of the source it was translated from. The extract config documents `zh-Hant` in its `--locales`, so `check:i18n` now gates the new bundles. Package 11 of #30512, first of seven locales; `ar`, `fr`, `pt-BR`, `ru`, `de` and `ko` follow.

‎packages/cli/test/platform-page-i18n-parity.test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,12 @@ const RECORD_PAGES: Array<Record<string, any>> = Object.values(
738738
const SHIPPED_LOCALES = Object.keys(SetupAppTranslations as Record<string, unknown>);
739739

740740
/**
741-
* A key is a locale code (`en`, `zh-CN`). Deliberately a shape test rather than
742-
* a membership test against `SHIPPED_LOCALES`: a map carrying a locale the
743-
* bundle does not ship is still an inline map, and must still be judged.
741+
* A key is a locale code (`en`, `zh-CN`, and the platform locale table's
742+
* script-subtag tag `zh-Hant`). Deliberately a shape test rather than a
743+
* membership test against `SHIPPED_LOCALES`: a map carrying a locale the bundle
744+
* does not ship is still an inline map, and must still be judged.
744745
*/
745-
const LOCALE_KEY = /^[a-z]{2}(-[A-Z]{2})?$/;
746+
const LOCALE_KEY = /^[a-z]{2}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$/;
746747

747748
/** An inline `I18nLabel` map: every key a locale code, every value a string. */
748749
const isInlineLocaleMap = (value: unknown): value is Record<string, string> => {

‎packages/platform-objects/scripts/i18n-extract.config.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* pointed at this file via `bundle-require`:
99
*
1010
* os i18n extract packages/platform-objects/scripts/i18n-extract.config.ts \
11-
* --locales=zh-CN,ja-JP,es-ES \
11+
* --locales=zh-CN,ja-JP,es-ES,zh-Hant \
1212
* --fill=default \
1313
* --source-hashes \
1414
* --out=packages/platform-objects/src/apps/translations
@@ -221,10 +221,12 @@ import { enObjects } from '../src/apps/translations/en.objects.generated.js';
221221
import { zhCNObjects } from '../src/apps/translations/zh-CN.objects.generated.js';
222222
import { jaJPObjects } from '../src/apps/translations/ja-JP.objects.generated.js';
223223
import { esESObjects } from '../src/apps/translations/es-ES.objects.generated.js';
224+
import { zhHantObjects } from '../src/apps/translations/zh-Hant.objects.generated.js';
224225
import { enMetadataForms } from '../src/apps/translations/en.metadata-forms.generated.js';
225226
import { zhCNMetadataForms } from '../src/apps/translations/zh-CN.metadata-forms.generated.js';
226227
import { jaJPMetadataForms } from '../src/apps/translations/ja-JP.metadata-forms.generated.js';
227228
import { esESMetadataForms } from '../src/apps/translations/es-ES.metadata-forms.generated.js';
229+
import { zhHantMetadataForms } from '../src/apps/translations/zh-Hant.metadata-forms.generated.js';
228230

229231
// ── Existing hand-authored app/dashboard/page translations ────────────────
230232
// The per-locale assemblers, NOT the `SetupAppTranslations` wrapper. Each one
@@ -247,6 +249,7 @@ import { en } from '../src/apps/translations/en.js';
247249
import { zhCN } from '../src/apps/translations/zh-CN.js';
248250
import { jaJP } from '../src/apps/translations/ja-JP.js';
249251
import { esES } from '../src/apps/translations/es-ES.js';
252+
import { zhHant } from '../src/apps/translations/zh-Hant.js';
250253

251254
/**
252255
* The annotation is load-bearing, not decoration (#10868). `defineStack`
@@ -347,6 +350,7 @@ const config: ObjectStackDefinition = defineStack({
347350
{ 'zh-CN': { ...zhCN, objects: zhCNObjects, metadataForms: zhCNMetadataForms } },
348351
{ 'ja-JP': { ...jaJP, objects: jaJPObjects, metadataForms: jaJPMetadataForms } },
349352
{ 'es-ES': { ...esES, objects: esESObjects, metadataForms: esESMetadataForms } },
353+
{ 'zh-Hant': { ...zhHant, objects: zhHantObjects, metadataForms: zhHantMetadataForms } },
350354
],
351355
});
352356

‎packages/platform-objects/src/apps/dashboards/system-overview-null-label.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('System Overview: the null-user bucket reads "System"', () => {
3030
'zh-CN': '系统',
3131
'ja-JP': 'システム',
3232
'es-ES': 'Sistema',
33+
'zh-Hant': '系統',
3334
});
3435
});
3536

‎packages/platform-objects/src/apps/dashboards/system.datasets.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const SysAuditLogDataset = defineDataset({
5757
label: 'User',
5858
field: 'user_id',
5959
type: 'lookup',
60-
nullLabel: { en: 'System', 'zh-CN': '系统', 'ja-JP': 'システム', 'es-ES': 'Sistema' },
60+
nullLabel: { en: 'System', 'zh-CN': '系统', 'ja-JP': 'システム', 'es-ES': 'Sistema', 'zh-Hant': '系統' },
6161
},
6262
],
6363
measures: [{ name: 'event_count', label: 'Events', aggregate: 'count' }],

‎packages/platform-objects/src/apps/setup-copy-vocabulary.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ import { en } from './translations/en.js';
4545
import { zhCN } from './translations/zh-CN.js';
4646
import { jaJP } from './translations/ja-JP.js';
4747
import { esES } from './translations/es-ES.js';
48+
import { zhHant } from './translations/zh-Hant.js';
4849
import { enObjects } from './translations/en.objects.generated.js';
4950
import { zhCNObjects } from './translations/zh-CN.objects.generated.js';
5051
import { jaJPObjects } from './translations/ja-JP.objects.generated.js';
5152
import { esESObjects } from './translations/es-ES.objects.generated.js';
53+
import { zhHantObjects } from './translations/zh-Hant.objects.generated.js';
5254
import { enMetadataForms } from './translations/en.metadata-forms.generated.js';
5355
import { zhCNMetadataForms } from './translations/zh-CN.metadata-forms.generated.js';
5456
import { jaJPMetadataForms } from './translations/ja-JP.metadata-forms.generated.js';
5557
import { esESMetadataForms } from './translations/es-ES.metadata-forms.generated.js';
58+
import { zhHantMetadataForms } from './translations/zh-Hant.metadata-forms.generated.js';
5659

5760
/** The design-record vocabulary an admin-facing string must not carry. */
5861
const DESIGN_RECORD_VOCABULARY: ReadonlyArray<readonly [string, RegExp]> = [
@@ -127,10 +130,13 @@ function objectSchemas(...modules: Array<Record<string, unknown>>): Map<string,
127130
return byName;
128131
}
129132

130-
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES } as const;
131-
const OBJECT_BUNDLES = { en: enObjects, 'zh-CN': zhCNObjects, 'ja-JP': jaJPObjects, 'es-ES': esESObjects } as const;
133+
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES, 'zh-Hant': zhHant } as const;
134+
const OBJECT_BUNDLES = {
135+
en: enObjects, 'zh-CN': zhCNObjects, 'ja-JP': jaJPObjects, 'es-ES': esESObjects, 'zh-Hant': zhHantObjects,
136+
} as const;
132137
const FORM_BUNDLES = {
133138
en: enMetadataForms, 'zh-CN': zhCNMetadataForms, 'ja-JP': jaJPMetadataForms, 'es-ES': esESMetadataForms,
139+
'zh-Hant': zhHantMetadataForms,
134140
} as const;
135141

136142
describe('Setup copy carries no design-record vocabulary', () => {

‎packages/platform-objects/src/apps/setup-nav-distinct-labels.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import { en } from './translations/en.js';
1515
import { zhCN } from './translations/zh-CN.js';
1616
import { jaJP } from './translations/ja-JP.js';
1717
import { esES } from './translations/es-ES.js';
18+
import { zhHant } from './translations/zh-Hant.js';
1819

19-
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES } as const;
20+
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES, 'zh-Hant': zhHant } as const;
2021

2122
type NavItem = { id?: string; label?: string };
2223

‎packages/platform-objects/src/apps/setup-nav-per-user-stores.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ describe('(2) the User page lists each per-user store, keyed to its record (#238
110110
'zh-CN': '偏好设置',
111111
'ja-JP': '設定',
112112
'es-ES': 'Preferencias',
113+
'zh-Hant': '偏好設定',
113114
});
114115
expect((tabOf('sys_account')?.label as Rec)?.en).toBe('Linked Accounts');
115-
expect(Object.keys((tabOf('sys_account')?.label as Rec) ?? {}).sort()).toEqual(['en', 'es-ES', 'ja-JP', 'zh-CN']);
116+
expect(Object.keys((tabOf('sys_account')?.label as Rec) ?? {}).sort()).toEqual(['en', 'es-ES', 'ja-JP', 'zh-CN', 'zh-Hant']);
116117
});
117118
});
118119

‎packages/platform-objects/src/apps/translations/app-nav-translation-parity.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ import { en } from './en.js';
5858
import { zhCN } from './zh-CN.js';
5959
import { jaJP } from './ja-JP.js';
6060
import { esES } from './es-ES.js';
61+
import { zhHant } from './zh-Hant.js';
6162

62-
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES } as const;
63+
const LOCALES = { en, 'zh-CN': zhCN, 'ja-JP': jaJP, 'es-ES': esES, 'zh-Hant': zhHant } as const;
6364

6465
/** Every statically declared nav item of an app, depth-first, with its label. */
6566
function navItems(app: { navigation?: unknown[] }): Array<{ id: string; label?: string }> {

‎packages/platform-objects/src/apps/translations/bu-rename-consistency.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import { enObjects } from './en.objects.generated.js';
1414
import { zhCNObjects } from './zh-CN.objects.generated.js';
1515
import { jaJPObjects } from './ja-JP.objects.generated.js';
1616
import { esESObjects } from './es-ES.objects.generated.js';
17+
import { zhHantObjects } from './zh-Hant.objects.generated.js';
1718

1819
const LOCALES = [
1920
{ name: 'en', objs: enObjects as Record<string, any>, old: /\bDepartment\b/ },
2021
{ name: 'zh-CN', objs: zhCNObjects as Record<string, any>, old: /部门/ },
2122
{ name: 'ja-JP', objs: jaJPObjects as Record<string, any>, old: /部門/ },
2223
{ name: 'es-ES', objs: esESObjects as Record<string, any>, old: /Departamento/ },
24+
{ name: 'zh-Hant', objs: zhHantObjects as Record<string, any>, old: /部門/ },
2325
];
2426
const OBJECTS = ['sys_business_unit', 'sys_business_unit_member'];
2527

0 commit comments

Comments
 (0)