@urbicon-ui/i18n 8.8.0 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,10 +32,12 @@ Peer dependencies: `svelte` (^5.40 — uses runes + `createContext`-era context)
|
|
|
32
32
|
</I18nProvider>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
<!-- typecheck -->
|
|
35
36
|
```ts
|
|
36
37
|
// +layout.server.ts — resolve the locale per request (SSR), cookie + Accept-Language
|
|
37
38
|
import { resolveLocale } from '@urbicon-ui/i18n';
|
|
38
|
-
|
|
39
|
+
import type { LayoutServerLoad } from './$types';
|
|
40
|
+
export const load: LayoutServerLoad = ({ request }) => ({ locale: resolveLocale(request) });
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
**2. Read translations in components through a hook** — `useI18n()` for the global surface, or a package's `use<Package>I18n()` for its typed keys.
|
|
@@ -233,6 +235,7 @@ The provider's on-mount load runs in a **client-only** `$effect`. So under SSR a
|
|
|
233
235
|
|
|
234
236
|
The fix is to register the bundle **eagerly, once at server/app start**. The registry is module-global and holds only static, request-identical translation data, so a single startup registration is SSR-safe (it carries no per-request state). Every package factory returns `registerLocale(locale, bundle)` for this; `@urbicon-ui/blocks` re-exports it as `registerBlocksLocale`:
|
|
235
237
|
|
|
238
|
+
<!-- typecheck -->
|
|
236
239
|
```ts
|
|
237
240
|
// src/hooks.server.ts (or any module evaluated once at server start)
|
|
238
241
|
import { registerBlocksLocale } from '@urbicon-ui/blocks';
|
|
@@ -290,6 +293,7 @@ it('en/de key parity', () => {
|
|
|
290
293
|
|
|
291
294
|
## API Surface
|
|
292
295
|
|
|
296
|
+
<!-- typecheck -->
|
|
293
297
|
```ts
|
|
294
298
|
// Provider + hooks + server helper
|
|
295
299
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbicon-ui/i18n",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.0",
|
|
4
4
|
"description": "Runes-based localization for Svelte 5 apps and the Urbicon UI design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@sveltejs/package": "^2.5.8",
|
|
25
25
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
26
26
|
"@types/node": "^26.2.0",
|
|
27
|
-
"@urbicon-ui/shared-types": "8.
|
|
27
|
+
"@urbicon-ui/shared-types": "8.10.0",
|
|
28
28
|
"prettier": "^3.9.6",
|
|
29
29
|
"prettier-plugin-svelte": "^4.1.1",
|
|
30
30
|
"prettier-plugin-tailwindcss": "^0.8.1",
|