@verbaly/nuxt 0.21.0 → 0.23.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 +6 -6
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<img src="https://raw.githubusercontent.com/AronSoto/verbaly/develop/assets/logo.png" alt="Verbaly" width="300" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<p align="center"><em>Nuxt integration for Verbaly
|
|
5
|
+
<p align="center"><em>Nuxt integration for Verbaly: zero-config module with per-request locale negotiation and flash-free hydration.</em></p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@verbaly/nuxt"><img src="https://img.shields.io/npm/v/@verbaly/nuxt?logo=npm&color=cb3837" alt="npm version" /></a>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
Server-rendered pages arrive already translated in the visitor's language
|
|
14
|
+
Server-rendered pages arrive already translated in the visitor's language (cookie first, 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
16
|
One line in `nuxt.config` wires everything: the Vite plugin (live extraction + the `virtual:verbaly` module), the per-request negotiation and `<html lang>`.
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ pnpm add verbaly @verbaly/nuxt @verbaly/vue
|
|
|
23
23
|
|
|
24
24
|
## ⚡ Wire it up
|
|
25
25
|
|
|
26
|
-
**1. The module
|
|
26
|
+
**1. The module**, the whole setup:
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
29
|
// nuxt.config.ts
|
|
@@ -38,7 +38,7 @@ Locales live in your `verbaly.config` (created by `npx verbaly init`), or inline
|
|
|
38
38
|
modules: [['@verbaly/nuxt', { locales: ['en', 'es', 'pt'] }]],
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
**2. Write text
|
|
41
|
+
**2. Write text**: components use the Vue bindings as usual:
|
|
42
42
|
|
|
43
43
|
```vue
|
|
44
44
|
<script setup>
|
|
@@ -51,7 +51,7 @@ const t = useT();
|
|
|
51
51
|
</template>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
**3. Switching languages** (client)
|
|
54
|
+
**3. Switching languages** (client): persists the cookie the server reads:
|
|
55
55
|
|
|
56
56
|
```vue
|
|
57
57
|
<script setup>
|
|
@@ -76,7 +76,7 @@ Via the `verbaly` key in `nuxt.config` or inline module options (fully typed in
|
|
|
76
76
|
| `cookie` | Cookie read/written for the user's choice (default `verbaly-locale`); `false` = `Accept-Language` only. |
|
|
77
77
|
| `fallback` | Locale when nothing matches (defaults to the source locale). |
|
|
78
78
|
|
|
79
|
-
- No dependency on `nuxt` or `@nuxt/kit
|
|
79
|
+
- No dependency on `nuxt` or `@nuxt/kit`: the module is typed structurally; the only moving parts are core primitives (`resolveRequestLocale`) and the generated `createRequestInstance`.
|
|
80
80
|
- For fully static sites (`nuxi generate`), consider [`verbaly render`](https://www.npmjs.com/package/@verbaly/compiler) for pre-translated output per locale.
|
|
81
81
|
|
|
82
82
|
## 📚 Docs
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/nuxt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Nuxt integration for Verbaly
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"description": "Nuxt integration for Verbaly: zero-config module with per-request locale negotiation and flash-free hydration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
7
7
|
"nuxt",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@verbaly/vite": "^0.
|
|
44
|
+
"@verbaly/vite": "^0.23.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"vue": "^3.4.0",
|
|
48
|
-
"
|
|
49
|
-
"verbaly": "^0.
|
|
48
|
+
"verbaly": "^0.23.0",
|
|
49
|
+
"@verbaly/vue": "^0.23.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@nuxt/schema": "^4.4.8",
|
|
53
53
|
"happy-dom": "^20.10.6",
|
|
54
54
|
"vue": "^3.5.39",
|
|
55
|
-
"
|
|
56
|
-
"verbaly": "0.
|
|
55
|
+
"verbaly": "0.23.0",
|
|
56
|
+
"@verbaly/vue": "0.23.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsdown",
|