You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(i18n): add spec-format translations array for server mode + full i18n service
The real ObjectStack server (pnpm start) uses AppPlugin.loadTranslations()
which reads from a top-level `translations` array, not `i18n.bundles`.
Changes:
- objectstack.shared.ts: add `translations` array in spec format
(each entry maps locale → namespace-scoped data) so AppPlugin
can load them into the kernel's in-memory i18n fallback
- createKernel.ts: expand i18n service with loadTranslations(),
getLocales(), getDefaultLocale(), setDefaultLocale() methods
required by AppPlugin and HttpDispatcher
- i18n-translations.test.ts: add 3 server-mode compatibility tests
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/5581f722-7675-404d-9a1b-a025dca6484a
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
17
18
18
-**i18n Kernel Service `getTranslations` Returns Wrong Format** (`apps/console`): Fixed the `createKernel` i18n service registration where `getTranslations` returned a wrapped `{ locale, translations }` object instead of the flat `Record<string, any>` dictionary expected by the spec's `II18nService` interface. The HttpDispatcher wraps the service return value in `{ data: { locale, translations } }`, so the extra wrapping caused translations to be empty or double-nested in the API response (`/api/v1/i18n/translations/:lang`). The service now returns `resolveI18nTranslations(bundles, lang)` directly, aligning with the spec and making CRM business translations work correctly in all environments (MSW, server, dev).
19
19
20
+
-**i18n Translations Empty in Server Mode (`pnpm start`)** (`apps/console`): Fixed translations returning `{}` when running the real ObjectStack server on port 3000. The runtime's `AppPlugin.loadTranslations()` looks for translations in a top-level `translations` array in the config, but the console's `sharedConfig` only provided them in the custom `i18n.bundles` format used by `createKernel.ts`. Added a `translations` array in the spec-expected format (each entry maps `{ [locale]: { namespace: data } }`) to `objectstack.shared.ts` so that `AppPlugin` can load them into the kernel's in-memory i18n fallback. Also expanded the i18n service registration in `createKernel.ts` to implement `loadTranslations()`, `getLocales()`, `getDefaultLocale()`, and `setDefaultLocale()` — methods required by both `AppPlugin` and `HttpDispatcher`.
21
+
20
22
- **Duplicate Data in Calendar and Kanban Views** (`@object-ui/plugin-view`, `@object-ui/plugin-kanban`, `@object-ui/plugin-list`): Fixed a bug where Calendar and Kanban views displayed every record twice. The root cause was that `ObjectView` (plugin-view) unconditionally fetched data even when a `renderListView` callback was provided — causing parallel duplicate requests since `ListView` (plugin-list) independently fetches its own data. The duplicate fetch results triggered re-renders that destabilised child component rendering, leading to duplicate events in the calendar and duplicate cards on the kanban board. Additionally, `ObjectKanban` lacked proper external-data handling (`data`/`loading` props with `hasExternalData` guard), unlike `ObjectCalendar` which already had this pattern. Fixes: (1) `ObjectView` now skips its own fetch when `renderListView` is provided, (2) `ObjectKanban` now accepts explicit `data`/`loading` props and skips internal fetch when external data is supplied (matching `ObjectCalendar`'s pattern), (3) `ListView` now handles `{ value: [] }` OData response format consistently with `extractRecords` utility. Includes regression tests.
21
23
22
24
-**CI Build Fix: Replace dynamic `require()` with static imports** (`@object-ui/plugin-view`): Replaced module-level `require('@object-ui/react')` calls in `index.tsx` and `ObjectView.tsx` with static `import` statements. The dynamic `require()` pattern is not supported by Next.js Turbopack, causing the docs site build to fail during SSR prerendering of the `/docs/components/complex/view-switcher` page with `Error: dynamic usage of require is not supported`. Since `@object-ui/react` is already a declared dependency and other files in the package use static imports from it, replacing the `require()` with static imports is safe and eliminates the SSR compatibility issue.
0 commit comments