@verbaly/sveltekit 0.23.0 → 0.24.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 +7 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ export default { plugins: [verbaly(), sveltekit()] };
|
|
|
34
34
|
**2. The lang placeholder** in `src/app.html`:
|
|
35
35
|
|
|
36
36
|
```html
|
|
37
|
-
<html lang="%verbaly.lang%">
|
|
37
|
+
<html lang="%verbaly.lang%"></html>
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
**3. Server hook**: negotiates the locale per request:
|
|
@@ -99,16 +99,16 @@ export const load = async ({ data }) => ({
|
|
|
99
99
|
const verbaly = useVerbaly();
|
|
100
100
|
</script>
|
|
101
101
|
|
|
102
|
-
<button on:click={()
|
|
102
|
+
<button on:click="{()" ="">switchLocale(verbaly, 'es')}>Español</button>
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
## 📖 API
|
|
106
106
|
|
|
107
|
-
| Export
|
|
108
|
-
|
|
|
109
|
-
| `verbalyHandle({ locales, fallback?, cookie? })`
|
|
110
|
-
| `switchLocale(instance, locale, { cookie?, maxAge? })` | Awaits the catalog, switches the locale, writes the cookie and syncs `<html lang>`. SSR-safe.
|
|
111
|
-
| `LOCALE_COOKIE`
|
|
107
|
+
| Export | What it does |
|
|
108
|
+
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| `verbalyHandle({ locales, fallback?, cookie? })` | SvelteKit `handle` hook: resolves the request locale (cookie → `Accept-Language` → fallback), sets `event.locals.verbalyLocale`, fills `%verbaly.lang%` in `app.html`. |
|
|
110
|
+
| `switchLocale(instance, locale, { cookie?, maxAge? })` | Awaits the catalog, switches the locale, writes the cookie and syncs `<html lang>`. SSR-safe. |
|
|
111
|
+
| `LOCALE_COOKIE` | Default cookie name (`verbaly-locale`), shared with core's `localStorage` key. |
|
|
112
112
|
|
|
113
113
|
- `cookie: false` disables cookie reading/writing (pure `Accept-Language`).
|
|
114
114
|
- No dependency on `@sveltejs/kit`: the hook is typed structurally and stays compatible across Kit 2.x.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/sveltekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "SvelteKit SSR integration for Verbaly: per-request locale negotiation and flash-free hydration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"verbaly": "^0.
|
|
43
|
+
"verbaly": "^0.24.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@sveltejs/kit": "^2.69.3",
|
|
47
|
-
"svelte": "^5.56.
|
|
48
|
-
"verbaly": "0.
|
|
47
|
+
"svelte": "^5.56.5",
|
|
48
|
+
"verbaly": "0.24.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsdown",
|