Skip to content

Commit 34c9ccb

Browse files
committed
feat(i18n)!: read the platform locale table, add a generated zh-Hant pack, key packs by table tag
The Console's language packs are now the platform locale table (PLATFORM_LOCALES in @objectstack/spec/system): one pack per tag, keyed by the tag (zh-Hans, zh-Hant, pt-BR). zh-Hant is generated from zh-Hans by scripts/gen-zh-hant.mjs (OpenCC s2twp, pinned at 1.3.1, with the www.objectos.ai overrides plus five straddle repairs found reading the pack). Stored and browser codes keep resolving through the table's read aliases: resolveBuiltInLanguage (new export) reads zh/zh-CN as zh-Hans, zh-TW/zh-HK as zh-Hant, pt as pt-BR, then each shorter prefix; createI18n's fallbackLng maps every alias to its tag. The app-shell splash, outbound agent text and flow permission line read the snapshot by tag. The parity, outbound, eager-catalogue and en-drift checks read the table; en-drift reads a follower pack absent at the base as new. Claude-Session: https://claude.ai/code/session_01L6bhgThgWPADcpU1xXCBsw Co-authored-by: Claude <noreply@anthropic.com>
1 parent f6faf75 commit 34c9ccb

109 files changed

Lines changed: 6736 additions & 517 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎pnpm-lock.yaml‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/apps/console/src/__tests__/i18nAfterSignIn-12034.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ import { App } from '../App';
159159
import { loadLanguage } from '../loadLanguage';
160160
import { loadLocales } from '../loadLocales';
161161

162-
const zh = builtInLocales.zh;
162+
const zh = builtInLocales['zh-Hans'];
163163
const TOKEN = 'tok-12034';
164164
const USER = { id: 'u_12034', email: 'ada@example.com', name: 'Ada' } as unknown as AuthUser;
165165
const SESSION = { token: TOKEN, expiresAt: new Date(Date.now() + 3_600_000) };

‎ui/apps/console/src/pages/SharedRecordPage-26767.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe('SharedRecordPage — a shared non-chat record renders as read-only row
165165
});
166166

167167
it('under zh the value words come from the zh pack', async () => {
168-
const { zh, en } = builtInLocales;
168+
const { 'zh-Hans': zh, en } = builtInLocales;
169169
// Guard: these are real zh rows, not English copies.
170170
expect(zh.common.yes).not.toBe(en.common.yes);
171171
expect(zh.sharedRecord.redactedFields).not.toBe(en.sharedRecord.redactedFields);

‎ui/apps/console/src/pages/auth/__tests__/AcceptInvitationRoute.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,12 @@ describe('objectui#3811 — console routes DefaultAcceptInvitationPage', () => {
345345
renderRoute({ lang: 'zh' });
346346
await screen.findByTestId('accept-invitation-page');
347347

348-
const zh = builtInLocales.zh.organization.accept as Record<string, string>;
348+
const zh = builtInLocales['zh-Hans'].organization.accept as Record<string, string>;
349349
expect(zh.accept).toBe('接受邀请');
350350
expect(screen.getByRole('button', { name: zh.accept })).toBeInTheDocument();
351351
expect(screen.getByText(zh.organization)).toBeInTheDocument();
352352
expect(screen.getByText(zh.expiresAt)).toBeInTheDocument();
353353
// The pack that used to serve this screen's other half is gone entirely.
354-
expect((builtInLocales.zh as Record<string, unknown>).acceptInvitation).toBeUndefined();
354+
expect((builtInLocales['zh-Hans'] as Record<string, unknown>).acceptInvitation).toBeUndefined();
355355
});
356356
});

‎ui/apps/console/src/pages/auth/__tests__/LoginPage.ssoLabels-12762.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function expectSsoCopy(expected: Record<keyof typeof ENGLISH, string>) {
9090

9191
describe('console LoginPage — SSO copy under zh (objectui#12762)', () => {
9292
it('draws the zh bundle value of each SSO label, and no English default', async () => {
93-
const zh = builtInLocales.zh.auth.login;
93+
const zh = builtInLocales['zh-Hans'].auth.login;
9494
for (const key of SSO_KEYS) {
9595
expect(typeof zh[key], `zh auth.login.${key}`).toBe('string');
9696
expect(zh[key], `zh auth.login.${key}`).not.toBe(ENGLISH[key]);

‎ui/apps/console/src/pages/auth/__tests__/loginFormLabels-everyMember-12762.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function labelMembers(): string[] {
9797
}
9898

9999
const MEMBERS = labelMembers();
100-
const ZH_LOGIN = builtInLocales.zh.auth.login as Record<string, unknown>;
100+
const ZH_LOGIN = builtInLocales['zh-Hans'].auth.login as Record<string, unknown>;
101101

102102
function createMockClient(): AuthClient {
103103
return {

‎ui/apps/console/src/pages/auth/__tests__/registerRefusalCodes-10998.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ afterEach(() => {
114114
vi.restoreAllMocks();
115115
});
116116

117-
const zhErrors = builtInLocales.zh.auth.register.errors;
117+
const zhErrors = builtInLocales['zh-Hans'].auth.register.errors;
118118
const enErrors = builtInLocales.en.auth.register.errors;
119119

120120
describe('console RegisterPage — audience refusals under zh-CN (objectui#10998)', () => {

‎ui/apps/console/src/pages/consolePagesLocale-secondPass-13460.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ afterEach(() => {
7171
vi.unstubAllGlobals();
7272
});
7373

74-
const { zh, en } = builtInLocales;
74+
const { 'zh-Hans': zh, en } = builtInLocales;
7575
const zhAudit = zh.console.system.auditLog;
7676
const zhFlow = zh.console.developer.flowRuns;
7777
const zhAgent = zh.console.developer.agentConnect;

‎ui/apps/console/src/pages/developer/consolePagesLocale-13460.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ afterEach(() => {
6666
vi.unstubAllGlobals();
6767
});
6868

69-
const { zh, en } = builtInLocales;
69+
const { 'zh-Hans': zh, en } = builtInLocales;
7070
const zhDev = zh.console.developer;
7171
const enDev = en.console.developer;
7272
const zhSys = zh.console.system;

‎ui/apps/console/src/pages/developer/flowRunsClientDiagnostic-25916.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { FlowRunsPage } from './FlowRunsPage';
3333

3434
afterEach(() => cleanup());
3535

36-
const { zh } = builtInLocales;
36+
const { 'zh-Hans': zh } = builtInLocales;
3737
const zhFlow = zh.console.developer.flowRuns;
3838

3939
/** A client that serves one flow but has no automation surface at all. */

0 commit comments

Comments
 (0)