@verbaly/nuxt 0.77.0 → 0.79.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 -4
- package/dist/runtime/plugin.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
Server-rendered pages arrive already translated in the visitor's language (the address first when your URLs carry it, then the cookie, then `Accept-Language`, then your fallback) and the client hydrates with the **same locale and the same catalog**, so there's no flash of untranslated text and no hydration mismatch. Each request gets its **own instance**: no locale leaking between concurrent users.
|
|
15
15
|
|
|
16
|
-
One line in `nuxt.config` wires everything: the Vite plugin (live extraction + the `
|
|
16
|
+
One line in `nuxt.config` wires everything: the Vite plugin (live extraction + the `verbaly/app` module), the per-request negotiation and `<html lang>`/`<html dir>`.
|
|
17
17
|
|
|
18
18
|
## 🚀 Install
|
|
19
19
|
|
|
@@ -54,17 +54,18 @@ const t = useT();
|
|
|
54
54
|
|
|
55
55
|
`useT()` is typed by your catalog: the types go to `.nuxt/verbaly.d.ts`, where Nuxt links them, and `npx verbaly extract` writes that same file. A key no catalog has fails `nuxi typecheck`.
|
|
56
56
|
|
|
57
|
-
**3. Switching languages** (client):
|
|
57
|
+
**3. Switching languages** (client): with a prefix in your URLs it goes to the same page in the other language; without one it loads the catalog and switches this page. Either way it saves the choice in the cookie the server reads:
|
|
58
58
|
|
|
59
59
|
```vue
|
|
60
60
|
<script setup>
|
|
61
|
-
import { switchLocale } from 'verbaly';
|
|
61
|
+
import { switchLocale } from 'verbaly/app';
|
|
62
62
|
import { useVerbaly } from '@verbaly/vue';
|
|
63
|
+
// the instance this page renders with: the module builds one per request
|
|
63
64
|
const verbaly = useVerbaly();
|
|
64
65
|
</script>
|
|
65
66
|
|
|
66
67
|
<template>
|
|
67
|
-
<button @click="switchLocale(
|
|
68
|
+
<button @click="switchLocale('es', { instance: verbaly })">Español</button>
|
|
68
69
|
</template>
|
|
69
70
|
```
|
|
70
71
|
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -19,7 +19,7 @@ function readCookie(header, name) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
var plugin_default = defineNuxtPlugin(async (nuxtApp) => {
|
|
22
|
-
if (!Array.isArray(locales) || locales.length === 0) throw new Error("[verbaly] no `locales` in '
|
|
22
|
+
if (!Array.isArray(locales) || locales.length === 0) throw new Error("[verbaly] no `locales` in 'verbaly/app': declare them in verbaly.config or in the module options (`verbaly: { locales: [...] }` in nuxt.config)");
|
|
23
23
|
const runtime = useRuntimeConfig();
|
|
24
24
|
const config = runtime.public.verbaly ?? {};
|
|
25
25
|
const cookieName = config.cookie === false ? false : config.cookie || LOCALE_STORAGE_KEY;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.0",
|
|
4
4
|
"description": "Nuxt integration for Verbaly: zero-config module with per-request locale negotiation and flash-free hydration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@verbaly/compiler": "^0.
|
|
49
|
-
"@verbaly/vite": "^0.
|
|
48
|
+
"@verbaly/compiler": "^0.79.0",
|
|
49
|
+
"@verbaly/vite": "^0.79.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@verbaly/vue": "^0.
|
|
53
|
-
"verbaly": "^0.
|
|
52
|
+
"@verbaly/vue": "^0.79.0",
|
|
53
|
+
"verbaly": "^0.79.0",
|
|
54
54
|
"vue": "^3.4.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@nuxt/schema": "^4.6.3",
|
|
58
|
-
"@verbaly/vue": "^0.
|
|
58
|
+
"@verbaly/vue": "^0.79.0",
|
|
59
59
|
"happy-dom": "^21.0.4",
|
|
60
|
-
"verbaly": "^0.
|
|
60
|
+
"verbaly": "^0.79.0",
|
|
61
61
|
"vue": "^3.5.44"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|