@intlayer/docs 7.3.11 → 7.3.12
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/dist/cjs/generated/docs.entry.cjs +19 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +19 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_nuxt.md +305 -421
- package/docs/ar/intlayer_with_react_router_v7.md +33 -4
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/ar/intlayer_with_tanstack.md +2 -12
- package/docs/ar/intlayer_with_vite+vue.md +1 -0
- package/docs/de/intlayer_with_nuxt.md +296 -394
- package/docs/de/intlayer_with_react_router_v7.md +33 -4
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +573 -0
- package/docs/de/intlayer_with_tanstack.md +1 -0
- package/docs/de/intlayer_with_vite+vue.md +1 -0
- package/docs/en/intlayer_with_nuxt.md +242 -321
- package/docs/en/intlayer_with_react_router_v7.md +24 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +570 -0
- package/docs/en/intlayer_with_tanstack.md +2 -12
- package/docs/en/intlayer_with_vite+vue.md +49 -48
- package/docs/en-GB/intlayer_with_nuxt.md +262 -358
- package/docs/en-GB/intlayer_with_react_router_v7.md +33 -4
- package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +513 -0
- package/docs/en-GB/intlayer_with_tanstack.md +2 -12
- package/docs/en-GB/intlayer_with_vite+vue.md +1 -0
- package/docs/es/intlayer_with_nuxt.md +284 -375
- package/docs/es/intlayer_with_react_router_v7.md +33 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +575 -0
- package/docs/es/intlayer_with_tanstack.md +1 -0
- package/docs/es/intlayer_with_vite+vue.md +1 -2
- package/docs/fr/intlayer_with_nuxt.md +288 -387
- package/docs/fr/intlayer_with_react_router_v7.md +34 -5
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/fr/intlayer_with_tanstack.md +1 -0
- package/docs/fr/intlayer_with_vite+vue.md +1 -0
- package/docs/hi/intlayer_with_nuxt.md +318 -434
- package/docs/hi/intlayer_with_react_router_v7.md +33 -4
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +518 -0
- package/docs/hi/intlayer_with_tanstack.md +2 -12
- package/docs/hi/intlayer_with_vite+vue.md +1 -0
- package/docs/id/intlayer_with_nuxt.md +275 -376
- package/docs/id/intlayer_with_react_router_v7.md +29 -4
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +521 -0
- package/docs/id/intlayer_with_tanstack.md +2 -12
- package/docs/id/intlayer_with_vite+vue.md +1 -0
- package/docs/it/intlayer_with_nuxt.md +312 -408
- package/docs/it/intlayer_with_react_router_v7.md +33 -4
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/it/intlayer_with_tanstack.md +1 -0
- package/docs/ja/intlayer_with_nuxt.md +319 -414
- package/docs/ja/intlayer_with_react_router_v7.md +33 -4
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ja/intlayer_with_tanstack.md +2 -12
- package/docs/ja/intlayer_with_vite+vue.md +1 -0
- package/docs/ko/intlayer_with_nuxt.md +307 -406
- package/docs/ko/intlayer_with_react_router_v7.md +33 -4
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +515 -0
- package/docs/ko/intlayer_with_tanstack.md +2 -12
- package/docs/ko/intlayer_with_vite+vue.md +1 -0
- package/docs/pl/intlayer_with_nuxt.md +282 -457
- package/docs/pl/intlayer_with_react_router_v7.md +32 -5
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +615 -0
- package/docs/pl/intlayer_with_tanstack.md +2 -12
- package/docs/pl/intlayer_with_vite+vue.md +1 -0
- package/docs/pt/intlayer_with_nuxt.md +288 -403
- package/docs/pt/intlayer_with_react_router_v7.md +28 -0
- package/docs/pt/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_nuxt.md +300 -410
- package/docs/ru/intlayer_with_react_router_v7.md +33 -4
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ru/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_vite+vue.md +1 -0
- package/docs/tr/intlayer_with_nuxt.md +327 -392
- package/docs/tr/intlayer_with_react_router_v7.md +33 -4
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +572 -0
- package/docs/tr/intlayer_with_tanstack.md +2 -12
- package/docs/tr/intlayer_with_vite+vue.md +1 -0
- package/docs/vi/intlayer_with_nuxt.md +282 -399
- package/docs/vi/intlayer_with_react_router_v7.md +29 -4
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +523 -0
- package/docs/vi/intlayer_with_tanstack.md +2 -12
- package/docs/vi/intlayer_with_vite+vue.md +1 -0
- package/docs/zh/intlayer_with_nuxt.md +311 -444
- package/docs/zh/intlayer_with_react_router_v7.md +33 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/zh/intlayer_with_tanstack.md +2 -12
- package/docs/zh/intlayer_with_vite+vue.md +1 -0
- package/package.json +6 -6
- package/src/generated/docs.entry.ts +19 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-06-18
|
|
3
|
-
updatedAt: 2025-
|
|
4
|
-
title:
|
|
5
|
-
description: Entdecken Sie, wie Sie Ihre Nuxt- und Vue-Website mehrsprachig
|
|
3
|
+
updatedAt: 2025-12-07
|
|
4
|
+
title: So übersetzen Sie Ihre Nuxt- und Vue-App – i18n-Anleitung 2025
|
|
5
|
+
description: Entdecken Sie, wie Sie Ihre Nuxt- und Vue-Website mehrsprachig gestalten. Folgen Sie der Dokumentation, um sie zu internationalisieren (i18n) und zu übersetzen.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalisierung
|
|
8
8
|
- Dokumentation
|
|
@@ -14,34 +14,69 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- nuxt-and-vue
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-nuxt-template
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-nuxt-4-template
|
|
18
|
+
youtubeVideo: https://www.youtube.com/watch?v=IE3XWkZ6a5U
|
|
18
19
|
history:
|
|
20
|
+
- version: 7.3.11
|
|
21
|
+
date: 2025-12-07
|
|
22
|
+
changes: Aktualisierung von LocaleSwitcher, SEO, Metadaten
|
|
19
23
|
- version: 5.5.10
|
|
20
24
|
date: 2025-06-29
|
|
21
25
|
changes: Historie initialisiert
|
|
22
26
|
---
|
|
23
27
|
|
|
24
|
-
# Übersetzen Sie Ihre Nuxt
|
|
28
|
+
# Übersetzen Sie Ihre Nuxt- und Vue-Website mit Intlayer | Internationalisierung (i18n)
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
## Inhaltsverzeichnis
|
|
31
|
+
|
|
32
|
+
<TOC/>
|
|
27
33
|
|
|
28
34
|
## Was ist Intlayer?
|
|
29
35
|
|
|
30
|
-
**Intlayer** ist eine innovative,
|
|
36
|
+
**Intlayer** ist eine innovative, Open-Source Internationalisierungsbibliothek (i18n), die entwickelt wurde, um die mehrsprachige Unterstützung in modernen Webanwendungen zu vereinfachen.
|
|
31
37
|
|
|
32
38
|
Mit Intlayer können Sie:
|
|
33
39
|
|
|
34
|
-
- **Übersetzungen einfach verwalten**
|
|
40
|
+
- **Übersetzungen einfach verwalten** durch deklarative Wörterbücher auf Komponentenebene.
|
|
35
41
|
- **Metadaten, Routen und Inhalte dynamisch lokalisieren**.
|
|
36
|
-
- **TypeScript-Unterstützung sicherstellen**
|
|
42
|
+
- **TypeScript-Unterstützung sicherstellen** mit automatisch generierten Typen, die Autovervollständigung und Fehlererkennung verbessern.
|
|
37
43
|
- **Von erweiterten Funktionen profitieren**, wie dynamische Spracherkennung und Umschaltung.
|
|
38
44
|
|
|
39
45
|
---
|
|
40
46
|
|
|
41
47
|
## Schritt-für-Schritt-Anleitung zur Einrichtung von Intlayer in einer Nuxt-Anwendung
|
|
42
48
|
|
|
49
|
+
<iframe
|
|
50
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-nuxt-4-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
51
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
52
|
+
title="Demo CodeSandbox - Wie Sie Ihre Anwendung mit Intlayer internationalisieren"
|
|
53
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
54
|
+
loading="lazy"
|
|
55
|
+
/>
|
|
56
|
+
|
|
43
57
|
### Schritt 1: Abhängigkeiten installieren
|
|
44
58
|
|
|
59
|
+
<Tab defaultTab="video">
|
|
60
|
+
<TabItem label="Video" value="video">
|
|
61
|
+
|
|
62
|
+
<iframe title="Wie übersetzt man seine Nuxt- und Vue-App mit Intlayer? Entdecken Sie Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/IE3XWkZ6a5U?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
63
|
+
|
|
64
|
+
</TabItem>
|
|
65
|
+
<TabItem label="Code" value="code">
|
|
66
|
+
|
|
67
|
+
<iframe
|
|
68
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-nuxt-4-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
69
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
70
|
+
title="Demo CodeSandbox - Wie Sie Ihre Anwendung mit Intlayer internationalisieren"
|
|
71
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
72
|
+
loading="lazy"
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
</TabItem>
|
|
76
|
+
</Tab>
|
|
77
|
+
|
|
78
|
+
Siehe [Application Template](https://github.com/aymericzip/intlayer-nuxt-4-template) auf GitHub.
|
|
79
|
+
|
|
45
80
|
Installieren Sie die notwendigen Pakete mit npm:
|
|
46
81
|
|
|
47
82
|
```bash packageManager="npm"
|
|
@@ -61,13 +96,13 @@ yarn add --save-dev nuxt-intlayer
|
|
|
61
96
|
|
|
62
97
|
- **intlayer**
|
|
63
98
|
|
|
64
|
-
Das Kernpaket, das Internationalisierungswerkzeuge für Konfigurationsmanagement, Übersetzung, [Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/
|
|
99
|
+
Das Kernpaket, das Internationalisierungswerkzeuge für Konfigurationsmanagement, Übersetzung, [Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/content_file.md), Transpilation und [CLI-Befehle](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/cli/index.md) bereitstellt.
|
|
65
100
|
|
|
66
101
|
- **vue-intlayer**
|
|
67
102
|
Das Paket, das Intlayer in Vue-Anwendungen integriert. Es stellt die Composables für die Vue-Komponenten bereit.
|
|
68
103
|
|
|
69
104
|
- **nuxt-intlayer**
|
|
70
|
-
Das Nuxt-Modul, das Intlayer
|
|
105
|
+
Das Nuxt-Modul, das Intlayer mit Nuxt-Anwendungen integriert. Es bietet automatische Einrichtung, Middleware zur Lokalerkennung, Cookie-Verwaltung und URL-Weiterleitung.
|
|
71
106
|
|
|
72
107
|
### Schritt 2: Konfiguration Ihres Projekts
|
|
73
108
|
|
|
@@ -86,9 +121,6 @@ const config: IntlayerConfig = {
|
|
|
86
121
|
],
|
|
87
122
|
defaultLocale: Locales.ENGLISH,
|
|
88
123
|
},
|
|
89
|
-
content: {
|
|
90
|
-
contentDir: ["."], // Da Intlayer standardmäßig Inhaltsdeklarationsdateien aus dem Verzeichnis `./src` überwacht
|
|
91
|
-
},
|
|
92
124
|
};
|
|
93
125
|
|
|
94
126
|
export default config;
|
|
@@ -98,7 +130,6 @@ export default config;
|
|
|
98
130
|
import { Locales } from "intlayer";
|
|
99
131
|
|
|
100
132
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
101
|
-
// Konfiguration für die Internationalisierung und Inhaltsverzeichnis
|
|
102
133
|
const config = {
|
|
103
134
|
internationalization: {
|
|
104
135
|
locales: [
|
|
@@ -109,9 +140,6 @@ const config = {
|
|
|
109
140
|
],
|
|
110
141
|
defaultLocale: Locales.ENGLISH,
|
|
111
142
|
},
|
|
112
|
-
content: {
|
|
113
|
-
contentDir: ["."], // Verzeichnis für Inhaltsdeklarationen
|
|
114
|
-
},
|
|
115
143
|
};
|
|
116
144
|
|
|
117
145
|
export default config;
|
|
@@ -121,7 +149,6 @@ export default config;
|
|
|
121
149
|
const { Locales } = require("intlayer");
|
|
122
150
|
|
|
123
151
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
124
|
-
// Konfiguration für die Internationalisierung und Inhaltsverzeichnis
|
|
125
152
|
const config = {
|
|
126
153
|
internationalization: {
|
|
127
154
|
locales: [
|
|
@@ -132,15 +159,12 @@ const config = {
|
|
|
132
159
|
],
|
|
133
160
|
defaultLocale: Locales.ENGLISH,
|
|
134
161
|
},
|
|
135
|
-
content: {
|
|
136
|
-
contentDir: ["."],
|
|
137
|
-
},
|
|
138
162
|
};
|
|
139
163
|
|
|
140
164
|
module.exports = config;
|
|
141
165
|
```
|
|
142
166
|
|
|
143
|
-
> Durch diese Konfigurationsdatei können Sie lokalisierte URLs, Middleware-Weiterleitungen, Cookie-Namen, den Speicherort und die Erweiterung Ihrer Inhaltsdeklarationen einrichten, Intlayer-
|
|
167
|
+
> Durch diese Konfigurationsdatei können Sie lokalisierte URLs, Middleware-Weiterleitungen, Cookie-Namen, den Speicherort und die Erweiterung Ihrer Inhaltsdeklarationen einrichten, Intlayer-Logs in der Konsole deaktivieren und vieles mehr. Für eine vollständige Liste der verfügbaren Parameter konsultieren Sie bitte die [Konfigurationsdokumentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/configuration.md).
|
|
144
168
|
|
|
145
169
|
### Schritt 3: Integrieren Sie Intlayer in Ihre Nuxt-Konfiguration
|
|
146
170
|
|
|
@@ -155,225 +179,44 @@ export default defineNuxtConfig({
|
|
|
155
179
|
});
|
|
156
180
|
```
|
|
157
181
|
|
|
158
|
-
> Das `nuxt-intlayer`-Modul übernimmt automatisch die Integration von Intlayer
|
|
182
|
+
> Das `nuxt-intlayer`-Modul übernimmt automatisch die Integration von Intlayer mit Nuxt. Es richtet den Aufbau der Inhaltsdeklarationen ein, überwacht Dateien im Entwicklungsmodus, stellt Middleware zur Lokalerkennung bereit und verwaltet die lokalisierte Routing.
|
|
159
183
|
|
|
160
184
|
### Schritt 4: Deklarieren Sie Ihre Inhalte
|
|
161
185
|
|
|
162
186
|
Erstellen und verwalten Sie Ihre Inhaltsdeklarationen, um Übersetzungen zu speichern:
|
|
163
187
|
|
|
164
|
-
```tsx fileName="
|
|
165
|
-
import {
|
|
188
|
+
```tsx fileName="content/home-page.content.ts" contentDeclarationFormat="typescript"
|
|
189
|
+
import { type Dictionary, t } from "intlayer";
|
|
166
190
|
|
|
167
|
-
const
|
|
168
|
-
key: "
|
|
191
|
+
const content = {
|
|
192
|
+
key: "home-page",
|
|
169
193
|
content: {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
175
|
-
}),
|
|
176
|
-
checkOut: t({ en: "Check out ", fr: "Vérifiez ", es: "Compruebe " }),
|
|
177
|
-
nuxtIntlayer: t({
|
|
178
|
-
en: "Nuxt Intlayer documentation",
|
|
179
|
-
fr: "Documentation de Nuxt Intlayer",
|
|
180
|
-
es: "Documentación de Nuxt Intlayer",
|
|
181
|
-
}),
|
|
182
|
-
learnMore: t({
|
|
183
|
-
en: "Learn more about Nuxt in the ",
|
|
184
|
-
fr: "En savoir plus sur Nuxt dans la ",
|
|
185
|
-
es: "Aprenda más sobre Nuxt en la ",
|
|
186
|
-
}),
|
|
187
|
-
nuxtDocs: t({
|
|
188
|
-
en: "Nuxt Documentation",
|
|
189
|
-
fr: "Documentation Nuxt",
|
|
190
|
-
es: "Documentación de Nuxt",
|
|
194
|
+
title: t({
|
|
195
|
+
en: "Hello world",
|
|
196
|
+
fr: "Bonjour le monde",
|
|
197
|
+
es: "Hola mundo",
|
|
191
198
|
}),
|
|
192
|
-
|
|
193
|
-
en: "
|
|
194
|
-
fr: "
|
|
195
|
-
es: "
|
|
199
|
+
metaTitle: t({
|
|
200
|
+
en: "Welcome | My Application",
|
|
201
|
+
fr: "Bienvenue | Mon Application",
|
|
202
|
+
es: "Bienvenido | Mi Aplicación",
|
|
196
203
|
}),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
202
|
-
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
204
|
+
metaDescription: t({
|
|
205
|
+
en: "Entdecken Sie die mehrsprachige Startseite Ihrer Nuxt-App, die von Intlayer unterstützt wird.",
|
|
206
|
+
fr: "Découvrez la page d'accueil multilingue de votre application Nuxt propulsée par Intlayer.",
|
|
207
|
+
es: "Descubre la página de inicio multilingüe de tu aplicación Nuxt impulsada por Intlayer.",
|
|
203
208
|
}),
|
|
204
209
|
},
|
|
205
210
|
} satisfies Dictionary;
|
|
206
211
|
|
|
207
|
-
export default
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
|
|
211
|
-
import { t } from "intlayer";
|
|
212
|
-
|
|
213
|
-
/** @type {import('intlayer').Dictionary} */
|
|
214
|
-
const helloWorldContent = {
|
|
215
|
-
key: "helloworld",
|
|
216
|
-
content: {
|
|
217
|
-
count: t({
|
|
218
|
-
de: "Anzahl ist ",
|
|
219
|
-
en: "count is ",
|
|
220
|
-
fr: "le compte est ",
|
|
221
|
-
es: "el recuento es ",
|
|
222
|
-
}),
|
|
223
|
-
edit: t({
|
|
224
|
-
de: "Bearbeite <code>components/HelloWorld.vue</code> und speichere, um HMR zu testen",
|
|
225
|
-
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
226
|
-
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
227
|
-
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
228
|
-
}),
|
|
229
|
-
checkOut: t({
|
|
230
|
-
de: "Schauen Sie sich an ",
|
|
231
|
-
en: "Check out ",
|
|
232
|
-
fr: "Vérifiez ",
|
|
233
|
-
es: "Compruebe ",
|
|
234
|
-
}),
|
|
235
|
-
nuxtIntlayer: t({
|
|
236
|
-
de: "Nuxt Intlayer Dokumentation",
|
|
237
|
-
en: "Nuxt Intlayer documentation",
|
|
238
|
-
fr: "Documentation de Nuxt Intlayer",
|
|
239
|
-
es: "Documentación de Nuxt Intlayer",
|
|
240
|
-
}),
|
|
241
|
-
learnMore: t({
|
|
242
|
-
de: "Erfahren Sie mehr über Nuxt in der ",
|
|
243
|
-
en: "Learn more about Nuxt in the ",
|
|
244
|
-
fr: "En savoir plus sur Nuxt dans la ",
|
|
245
|
-
es: "Aprenda más sobre Nuxt en la ",
|
|
246
|
-
}),
|
|
247
|
-
nuxtDocs: t({
|
|
248
|
-
de: "Nuxt Dokumentation",
|
|
249
|
-
en: "Nuxt Documentation",
|
|
250
|
-
fr: "Documentation Nuxt",
|
|
251
|
-
es: "Documentación de Nuxt",
|
|
252
|
-
}),
|
|
253
|
-
readTheDocs: t({
|
|
254
|
-
de: "Klicken Sie auf das Nuxt-Logo, um mehr zu erfahren",
|
|
255
|
-
en: "Click on the Nuxt logo to learn more",
|
|
256
|
-
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
257
|
-
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
258
|
-
}),
|
|
259
|
-
},
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
export default helloWorldContent;
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
|
|
266
|
-
const { t } = require("intlayer");
|
|
267
|
-
|
|
268
|
-
/** @type {import('intlayer').Dictionary} */
|
|
269
|
-
const helloWorldContent = {
|
|
270
|
-
key: "helloworld",
|
|
271
|
-
content: {
|
|
272
|
-
count: t({ de: "Anzahl ist ", en: "count is ", fr: "le compte est ", es: "el recuento es " }),
|
|
273
|
-
edit: t({
|
|
274
|
-
de: "Bearbeite <code>components/HelloWorld.vue</code> und speichere, um HMR zu testen",
|
|
275
|
-
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
276
|
-
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
277
|
-
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
278
|
-
}),
|
|
279
|
-
checkOut: t({ de: "Schau dir an ", en: "Check out ", fr: "Vérifiez ", es: "Compruebe " }),
|
|
280
|
-
nuxtIntlayer: t({
|
|
281
|
-
de: "Nuxt Intlayer Dokumentation",
|
|
282
|
-
en: "Nuxt Intlayer documentation",
|
|
283
|
-
fr: "Documentation de Nuxt Intlayer",
|
|
284
|
-
es: "Documentación de Nuxt Intlayer",
|
|
285
|
-
}),
|
|
286
|
-
es: "Dokumentation von Nuxt Intlayer",
|
|
287
|
-
}),
|
|
288
|
-
learnMore: t({
|
|
289
|
-
en: "Erfahren Sie mehr über Nuxt in der ",
|
|
290
|
-
fr: "En savoir plus sur Nuxt dans la ",
|
|
291
|
-
es: "Aprenda más sobre Nuxt en la ",
|
|
292
|
-
}),
|
|
293
|
-
nuxtDocs: t({
|
|
294
|
-
en: "Nuxt-Dokumentation",
|
|
295
|
-
fr: "Documentation Nuxt",
|
|
296
|
-
es: "Documentación de Nuxt",
|
|
297
|
-
}),
|
|
298
|
-
readTheDocs: t({
|
|
299
|
-
en: "Klicken Sie auf das Nuxt-Logo, um mehr zu erfahren",
|
|
300
|
-
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
301
|
-
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
302
|
-
}),
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
module.exports = helloWorldContent;
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
|
|
310
|
-
{
|
|
311
|
-
"$schema": "https://intlayer.org/schema.json",
|
|
312
|
-
"key": "helloworld",
|
|
313
|
-
"content": {
|
|
314
|
-
"count": {
|
|
315
|
-
"nodeType": "translation",
|
|
316
|
-
"translation": {
|
|
317
|
-
"de": "Anzahl ist ",
|
|
318
|
-
"en": "count is ",
|
|
319
|
-
"fr": "le compte est ",
|
|
320
|
-
"es": "el recuento es "
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
"edit": {
|
|
324
|
-
"nodeType": "translation",
|
|
325
|
-
"translation": {
|
|
326
|
-
"de": "Bearbeite <code>components/HelloWorld.vue</code> und speichere, um HMR zu testen",
|
|
327
|
-
"en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
328
|
-
"fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
329
|
-
"es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
"checkOut": {
|
|
333
|
-
"nodeType": "translation",
|
|
334
|
-
"translation": {
|
|
335
|
-
"de": "Schau dir an ",
|
|
336
|
-
"en": "Check out ",
|
|
337
|
-
"fr": "Vérifiez ",
|
|
338
|
-
"es": "Compruebe "
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
"nuxtIntlayer": {
|
|
342
|
-
"nodeType": "translation",
|
|
343
|
-
"translation": {
|
|
344
|
-
"de": "Nuxt Intlayer Dokumentation"
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
"learnMore": {
|
|
348
|
-
"nodeType": "translation",
|
|
349
|
-
"translation": {
|
|
350
|
-
"de": "Erfahren Sie mehr über Nuxt in der "
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
"nuxtDocs": {
|
|
354
|
-
"nodeType": "translation",
|
|
355
|
-
"translation": {
|
|
356
|
-
"de": "Nuxt Dokumentation"
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
"readTheDocs": {
|
|
360
|
-
"nodeType": "translation",
|
|
361
|
-
"translation": {
|
|
362
|
-
"de": "Klicken Sie auf das Nuxt-Logo, um mehr zu erfahren"
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
"es": "Haga clic en el logotipo de Nuxt para obtener más información"
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
212
|
+
export default content;
|
|
370
213
|
```
|
|
371
214
|
|
|
372
215
|
> Ihre Inhaltsdeklarationen können überall in Ihrer Anwendung definiert werden, solange sie im Verzeichnis `contentDir` enthalten sind (standardmäßig `./src`). Und die Dateiendung der Inhaltsdeklaration entspricht (standardmäßig `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
373
216
|
|
|
374
|
-
> Für weitere Details siehe die [Dokumentation zur Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/
|
|
217
|
+
> Für weitere Details siehe die [Dokumentation zur Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/content_file.md).
|
|
375
218
|
|
|
376
|
-
### Schritt 5:
|
|
219
|
+
### Schritt 5: Intlayer in Ihrem Code verwenden
|
|
377
220
|
|
|
378
221
|
Greifen Sie in Ihrer gesamten Nuxt-Anwendung mit dem Composable `useIntlayer` auf Ihre Inhaltswörterbücher zu:
|
|
379
222
|
|
|
@@ -428,82 +271,72 @@ const countRef = ref(0);
|
|
|
428
271
|
|
|
429
272
|
Intlayer bietet verschiedene APIs, um auf Ihre Inhalte zuzugreifen:
|
|
430
273
|
|
|
431
|
-
- **Komponentenbasierte Syntax** (empfohlen):
|
|
432
|
-
Verwenden Sie die Syntax `<myContent />` oder `<Component :is="myContent" />`, um Inhalte als Intlayer-Knoten
|
|
274
|
+
- **Komponentenbasierte Syntax** (empfohlen):
|
|
275
|
+
Verwenden Sie die Syntax `<myContent />` oder `<Component :is="myContent" />`, um Inhalte als Intlayer-Knoten darzustellen. Dies integriert sich nahtlos mit dem [Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_visual_editor.md) und dem [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_CMS.md).
|
|
433
276
|
|
|
434
|
-
- **String-basierte Syntax**:
|
|
435
|
-
Verwenden Sie `{{ myContent }}`, um den Inhalt als
|
|
277
|
+
- **String-basierte Syntax**:
|
|
278
|
+
Verwenden Sie `{{ myContent }}`, um den Inhalt als einfachen Text ohne Unterstützung des Visual Editors darzustellen.
|
|
436
279
|
|
|
437
|
-
- **Raw-HTML-Syntax**:
|
|
280
|
+
- **Raw-HTML-Syntax**:
|
|
438
281
|
Verwenden Sie `<div v-html="myContent" />`, um den Inhalt als rohes HTML ohne Unterstützung des Visual Editors darzustellen.
|
|
439
282
|
|
|
440
|
-
- **Destrukturierungssyntax**:
|
|
441
|
-
Der `useIntlayer` Composable gibt ein Proxy-Objekt mit dem Inhalt zurück. Dieses Proxy
|
|
283
|
+
- **Destrukturierungssyntax**:
|
|
284
|
+
Der `useIntlayer` Composable gibt ein Proxy-Objekt mit dem Inhalt zurück. Dieses Proxy kann destrukturiert werden, um auf den Inhalt zuzugreifen und dabei die Reaktivität beizubehalten.
|
|
442
285
|
- Verwenden Sie `const content = useIntlayer("myContent");` und `{{ content.myContent }}` / `<content.myContent />`.
|
|
443
|
-
- Oder verwenden Sie `const { myContent } = useIntlayer("myContent");` und `{{ myContent
|
|
286
|
+
- Oder verwenden Sie `const { myContent } = useIntlayer("myContent");` und `{{ myContent}}` / `<myContent/>`, um den Inhalt zu destrukturieren.
|
|
444
287
|
|
|
445
288
|
### (Optional) Schritt 6: Ändern Sie die Sprache Ihres Inhalts
|
|
446
289
|
|
|
447
|
-
Um die Sprache Ihres Inhalts zu ändern, können Sie die Funktion `setLocale` verwenden, die vom `useLocale` Composable bereitgestellt wird. Diese Funktion ermöglicht es Ihnen, die
|
|
290
|
+
Um die Sprache Ihres Inhalts zu ändern, können Sie die Funktion `setLocale` verwenden, die vom `useLocale` Composable bereitgestellt wird. Diese Funktion ermöglicht es Ihnen, die Locale der Anwendung festzulegen und den Inhalt entsprechend zu aktualisieren.
|
|
448
291
|
|
|
449
|
-
Erstellen Sie eine Komponente, um zwischen
|
|
292
|
+
Erstellen Sie eine Komponente, um zwischen Sprachen mit `NuxtLink` zu wechseln. **Die Verwendung von Links anstelle von Buttons für den Locale-Wechsel ist eine bewährte Methode für SEO und die Auffindbarkeit der Seite**, da Suchmaschinen so alle lokalisierten Versionen Ihrer Seiten crawlen und indexieren können:
|
|
450
293
|
|
|
451
294
|
```vue fileName="components/LocaleSwitcher.vue"
|
|
452
|
-
<template>
|
|
453
|
-
<div class="locale-switcher">
|
|
454
|
-
<select v-model="selectedLocale" @change="changeLocale">
|
|
455
|
-
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
456
|
-
{{ getLocaleName(loc) }}
|
|
457
|
-
</option>
|
|
458
|
-
</select>
|
|
459
|
-
</div>
|
|
460
|
-
</template>
|
|
461
|
-
|
|
462
295
|
<script setup lang="ts">
|
|
463
|
-
import {
|
|
464
|
-
import { getLocaleName } from "intlayer";
|
|
296
|
+
import { getLocaleName, getLocalizedUrl } from "intlayer";
|
|
465
297
|
import { useLocale } from "vue-intlayer";
|
|
466
298
|
|
|
467
|
-
//
|
|
299
|
+
// Nuxt importiert useRoute automatisch
|
|
300
|
+
const route = useRoute();
|
|
468
301
|
const { locale, availableLocales, setLocale } = useLocale();
|
|
469
|
-
|
|
470
|
-
// Verfolge die ausgewählte Sprache mit einem ref
|
|
471
|
-
const selectedLocale = ref(locale.value);
|
|
472
|
-
|
|
473
|
-
// Aktualisiere die Sprache, wenn die Auswahl sich ändert
|
|
474
|
-
const changeLocale = () => setLocale(selectedLocale.value);
|
|
475
|
-
|
|
476
|
-
// Halte selectedLocale synchron mit der globalen Sprache
|
|
477
|
-
watch(
|
|
478
|
-
() => locale.value,
|
|
479
|
-
(newLocale) => {
|
|
480
|
-
selectedLocale.value = newLocale;
|
|
481
|
-
}
|
|
482
|
-
);
|
|
483
302
|
</script>
|
|
303
|
+
|
|
304
|
+
<template>
|
|
305
|
+
<nav class="locale-switcher">
|
|
306
|
+
<NuxtLink
|
|
307
|
+
v-for="localeEl in availableLocales"
|
|
308
|
+
:key="localeEl"
|
|
309
|
+
:to="getLocalizedUrl(route.fullPath, localeEl)"
|
|
310
|
+
class="locale-link"
|
|
311
|
+
:class="{ 'active-locale': localeEl === locale }"
|
|
312
|
+
@click="setLocale(localeEl)"
|
|
313
|
+
>
|
|
314
|
+
{{ getLocaleName(localeEl) }}
|
|
315
|
+
</NuxtLink>
|
|
316
|
+
</nav>
|
|
484
317
|
</template>
|
|
318
|
+
```
|
|
485
319
|
|
|
486
|
-
|
|
487
|
-
.locale-switcher {
|
|
488
|
-
margin: 1rem 0;
|
|
489
|
-
}
|
|
320
|
+
> Die Verwendung von `NuxtLink` mit korrekten `href`-Attributen (über `getLocalizedUrl`) stellt sicher, dass Suchmaschinen alle Sprachvarianten Ihrer Seiten entdecken können. Dies ist vorzuziehen gegenüber einem rein JavaScript-basierten Sprachwechsel, dem Suchmaschinen-Crawler möglicherweise nicht folgen.
|
|
490
321
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
322
|
+
Richten Sie anschließend Ihre `app.vue` so ein, dass Layouts verwendet werden:
|
|
323
|
+
|
|
324
|
+
```vue fileName="app.vue"
|
|
325
|
+
<template>
|
|
326
|
+
<NuxtLayout>
|
|
327
|
+
<NuxtPage />
|
|
328
|
+
</NuxtLayout>
|
|
329
|
+
</template>
|
|
497
330
|
```
|
|
498
331
|
|
|
499
|
-
|
|
332
|
+
### (Optional) Schritt 6b: Erstellen Sie ein Layout mit Navigation
|
|
500
333
|
|
|
501
|
-
|
|
334
|
+
Nuxt-Layouts ermöglichen es Ihnen, eine gemeinsame Struktur für Ihre Seiten zu definieren. Erstellen Sie ein Standard-Layout, das den Sprachumschalter und die Navigation enthält:
|
|
335
|
+
|
|
336
|
+
```vue fileName="layouts/default.vue"
|
|
502
337
|
<script setup lang="ts">
|
|
503
|
-
import
|
|
338
|
+
import Links from "~/components/Links.vue";
|
|
504
339
|
import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
|
|
505
|
-
|
|
506
|
-
const content = useIntlayer("app"); // Erstellen Sie die zugehörige Intlayer-Deklarationsdatei
|
|
507
340
|
</script>
|
|
508
341
|
|
|
509
342
|
<template>
|
|
@@ -512,15 +345,20 @@ const content = useIntlayer("app"); // Erstellen Sie die zugehörige Intlayer-De
|
|
|
512
345
|
<LocaleSwitcher />
|
|
513
346
|
</header>
|
|
514
347
|
<main>
|
|
515
|
-
<
|
|
348
|
+
<slot />
|
|
516
349
|
</main>
|
|
350
|
+
|
|
351
|
+
<Links href="/">Startseite</Links>
|
|
352
|
+
<Links href="/about">Über</Links>
|
|
517
353
|
</div>
|
|
518
354
|
</template>
|
|
519
355
|
```
|
|
520
356
|
|
|
521
|
-
|
|
357
|
+
Die `Links`-Komponente (siehe unten) stellt sicher, dass interne Navigationslinks automatisch lokalisiert werden.
|
|
358
|
+
|
|
359
|
+
### (Optional) Schritt 7: Lokalisierte Routen zu Ihrer Anwendung hinzufügen
|
|
522
360
|
|
|
523
|
-
Nuxt verwaltet
|
|
361
|
+
Nuxt verwaltet lokalisierte Routen automatisch, wenn das `nuxt-intlayer` Modul verwendet wird. Dies erstellt Routen für jede Sprache automatisch basierend auf der Struktur Ihres Seitenverzeichnisses.
|
|
524
362
|
|
|
525
363
|
Beispiel:
|
|
526
364
|
|
|
@@ -532,217 +370,283 @@ pages/
|
|
|
532
370
|
└── index.vue → /contact, /fr/contact, /es/contact
|
|
533
371
|
```
|
|
534
372
|
|
|
535
|
-
Um
|
|
373
|
+
Um lokalisierte Seiten zu erstellen, legen Sie einfach Ihre Vue-Dateien im Verzeichnis `pages/` an. Hier sind zwei Beispielseiten:
|
|
536
374
|
|
|
537
|
-
|
|
375
|
+
**Startseite (`pages/index.vue`):**
|
|
376
|
+
|
|
377
|
+
```vue fileName="pages/index.vue"
|
|
538
378
|
<script setup lang="ts">
|
|
539
379
|
import { useIntlayer } from "vue-intlayer";
|
|
540
380
|
|
|
541
|
-
const content = useIntlayer("
|
|
381
|
+
const content = useIntlayer("home-page");
|
|
382
|
+
|
|
383
|
+
useHead({
|
|
384
|
+
title: content.metaTitle.value,
|
|
385
|
+
meta: [
|
|
386
|
+
{
|
|
387
|
+
name: "description",
|
|
388
|
+
content: content.metaDescription.value,
|
|
389
|
+
},
|
|
390
|
+
],
|
|
391
|
+
});
|
|
542
392
|
</script>
|
|
543
393
|
|
|
544
394
|
<template>
|
|
545
|
-
<
|
|
546
|
-
<h1>{{ content.title }}</h1>
|
|
547
|
-
<p>{{ content.description }}</p>
|
|
548
|
-
</div>
|
|
395
|
+
<h1><content.title /></h1>
|
|
549
396
|
</template>
|
|
550
397
|
```
|
|
551
398
|
|
|
552
|
-
|
|
399
|
+
**Über-Seite (`pages/about.vue`):**
|
|
553
400
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
- Verwaltung von Sprach-Cookies
|
|
558
|
-
- Weiterleitung der Benutzer zur entsprechenden lokalisierten URL
|
|
401
|
+
```vue fileName="pages/about.vue"
|
|
402
|
+
<script setup lang="ts">
|
|
403
|
+
import { useIntlayer } from "vue-intlayer";
|
|
559
404
|
|
|
560
|
-
|
|
405
|
+
const content = useIntlayer("about-page");
|
|
561
406
|
|
|
562
|
-
|
|
407
|
+
useHead({
|
|
408
|
+
title: content.metaTitle.raw, // Verwenden Sie .raw für den Zugriff auf primitive Strings
|
|
409
|
+
meta: [
|
|
410
|
+
{
|
|
411
|
+
name: "description",
|
|
412
|
+
content: content.metaDescription.raw, // Verwenden Sie .raw für den Zugriff auf primitive Strings
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
});
|
|
416
|
+
</script>
|
|
563
417
|
|
|
564
|
-
```vue fileName="components/LocalizedLink.vue"
|
|
565
418
|
<template>
|
|
566
|
-
<
|
|
567
|
-
<slot />
|
|
568
|
-
</NuxtLink>
|
|
419
|
+
<h1><content.title /></h1>
|
|
569
420
|
</template>
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
> Hinweis: `useHead` wird in Nuxt automatisch importiert. Sie können auf Inhaltswerte entweder mit `.value` (reaktiv) oder `.raw` (primitiver String) je nach Bedarf zugreifen.
|
|
424
|
+
|
|
425
|
+
Das `nuxt-intlayer`-Modul wird automatisch:
|
|
426
|
+
|
|
427
|
+
- Die bevorzugte Sprache des Benutzers erkennen
|
|
428
|
+
- Die Sprachumschaltung über die URL handhaben
|
|
429
|
+
- Das passende `<html lang="">` Attribut setzen
|
|
430
|
+
- Sprach-Cookies verwalten
|
|
431
|
+
- Benutzer zur entsprechenden lokalisierten URL weiterleiten
|
|
432
|
+
|
|
433
|
+
### (Optional) Schritt 8: Erstellen einer lokalisierten Link-Komponente
|
|
570
434
|
|
|
435
|
+
Um sicherzustellen, dass die Navigation Ihrer Anwendung die aktuelle Locale berücksichtigt, können Sie eine benutzerdefinierte `Links`-Komponente erstellen. Diese Komponente fügt automatisch interne URLs mit der aktuellen Sprache als Präfix hinzu, was für **SEO und die Auffindbarkeit von Seiten** unerlässlich ist.
|
|
436
|
+
|
|
437
|
+
```vue fileName="components/Links.vue"
|
|
571
438
|
<script setup lang="ts">
|
|
572
|
-
import { computed } from "vue";
|
|
573
439
|
import { getLocalizedUrl } from "intlayer";
|
|
574
440
|
import { useLocale } from "vue-intlayer";
|
|
575
441
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
442
|
+
interface Props {
|
|
443
|
+
href: string;
|
|
444
|
+
locale?: string;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const props = defineProps<Props>();
|
|
448
|
+
|
|
449
|
+
const { locale: currentLocale } = useLocale();
|
|
582
450
|
|
|
583
|
-
|
|
451
|
+
// Berechnet den finalen Pfad
|
|
452
|
+
const finalPath = computed(() => {
|
|
453
|
+
// 1. Prüfen, ob der Link extern ist
|
|
454
|
+
const isExternal = /^https?:\/\//.test(props.href || "");
|
|
584
455
|
|
|
585
|
-
//
|
|
586
|
-
|
|
456
|
+
// 2. Wenn extern, unverändert zurückgeben (NuxtLink übernimmt die <a>-Tag-Erzeugung)
|
|
457
|
+
if (isExternal) return props.href;
|
|
587
458
|
|
|
588
|
-
//
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
);
|
|
459
|
+
// 3. Wenn intern, URL lokalisieren
|
|
460
|
+
const targetLocale = props.locale || currentLocale.value;
|
|
461
|
+
return getLocalizedUrl(props.href, targetLocale);
|
|
462
|
+
});
|
|
592
463
|
</script>
|
|
464
|
+
|
|
465
|
+
<template>
|
|
466
|
+
<NuxtLink :to="finalPath" v-bind="$attrs">
|
|
467
|
+
<slot />
|
|
468
|
+
</NuxtLink>
|
|
469
|
+
</template>
|
|
593
470
|
```
|
|
594
471
|
|
|
595
|
-
|
|
472
|
+
Verwenden Sie dann diese Komponente in Ihrer gesamten Anwendung:
|
|
473
|
+
|
|
474
|
+
```vue fileName="layouts/default.vue"
|
|
475
|
+
<script setup lang="ts">
|
|
476
|
+
import Links from "~/components/Links.vue";
|
|
477
|
+
import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
|
|
478
|
+
</script>
|
|
596
479
|
|
|
597
|
-
```vue fileName="pages/index.vue"
|
|
598
480
|
<template>
|
|
599
481
|
<div>
|
|
600
|
-
<
|
|
601
|
-
|
|
602
|
-
</
|
|
603
|
-
<
|
|
604
|
-
|
|
605
|
-
</
|
|
482
|
+
<header>
|
|
483
|
+
<LocaleSwitcher />
|
|
484
|
+
</header>
|
|
485
|
+
<main>
|
|
486
|
+
<slot />
|
|
487
|
+
</main>
|
|
488
|
+
|
|
489
|
+
<Links href="/">Startseite</Links>
|
|
490
|
+
<Links href="/about">Über</Links>
|
|
606
491
|
</div>
|
|
607
492
|
</template>
|
|
608
|
-
|
|
609
|
-
<script setup lang="ts">
|
|
610
|
-
import { useIntlayer } from "vue-intlayer";
|
|
611
|
-
import LocalizedLink from "~/components/LocalizedLink.vue";
|
|
612
|
-
|
|
613
|
-
const content = useIntlayer("home");
|
|
614
|
-
</script>
|
|
615
493
|
```
|
|
616
494
|
|
|
495
|
+
> Durch die Verwendung von `NuxtLink` mit lokalisierten Pfaden stellen Sie sicher, dass:
|
|
496
|
+
>
|
|
497
|
+
> - Suchmaschinen alle Sprachversionen Ihrer Seiten crawlen und indexieren können
|
|
498
|
+
> - Benutzer lokalisierten URLs direkt teilen können
|
|
499
|
+
> - Der Browserverlauf korrekt mit sprachpräfixierten URLs funktioniert
|
|
500
|
+
|
|
617
501
|
### (Optional) Schritt 9: Metadaten und SEO verwalten
|
|
618
502
|
|
|
619
|
-
Nuxt bietet hervorragende SEO-Fähigkeiten. Sie können Intlayer verwenden, um lokalisierte Metadaten zu verwalten:
|
|
503
|
+
Nuxt bietet hervorragende SEO-Fähigkeiten über den `useHead` Composable (automatisch importiert). Sie können Intlayer verwenden, um lokalisierte Metadaten zu verwalten, indem Sie den `.raw` oder `.value` Zugriff verwenden, um den primitiven String-Wert zu erhalten:
|
|
620
504
|
|
|
621
505
|
```vue fileName="pages/about.vue"
|
|
622
506
|
<script setup lang="ts">
|
|
623
|
-
import {
|
|
624
|
-
import { getIntlayer } from "intlayer";
|
|
625
|
-
import { useLocale } from "vue-intlayer";
|
|
507
|
+
import { useIntlayer } from "vue-intlayer";
|
|
626
508
|
|
|
627
|
-
|
|
628
|
-
const content =
|
|
509
|
+
// useHead wird in Nuxt automatisch importiert
|
|
510
|
+
const content = useIntlayer("about-page");
|
|
629
511
|
|
|
630
|
-
|
|
631
|
-
title: content.
|
|
632
|
-
|
|
512
|
+
useHead({
|
|
513
|
+
title: content.metaTitle.raw, // Verwenden Sie .raw für den Zugriff auf den primitiven String
|
|
514
|
+
meta: [
|
|
515
|
+
{
|
|
516
|
+
name: "description",
|
|
517
|
+
content: content.metaDescription.raw, // Verwenden Sie .raw für den Zugriff auf den primitiven Stringwert
|
|
518
|
+
},
|
|
519
|
+
],
|
|
633
520
|
});
|
|
634
521
|
</script>
|
|
635
522
|
|
|
636
523
|
<template>
|
|
637
|
-
<
|
|
638
|
-
<h1>{{ content.pageTitle }}</h1>
|
|
639
|
-
<p>{{ content.pageContent }}</p>
|
|
640
|
-
</div>
|
|
524
|
+
<h1><content.title /></h1>
|
|
641
525
|
</template>
|
|
642
526
|
```
|
|
643
527
|
|
|
528
|
+
> Alternativ können Sie die Funktion `import { getIntlayer } from "intlayer"` verwenden, um den Inhalt ohne Vue-Reaktivität zu erhalten.
|
|
529
|
+
|
|
530
|
+
> **Zugriff auf Inhaltswerte:**
|
|
531
|
+
>
|
|
532
|
+
> - Verwenden Sie `.raw`, um den primitiven Stringwert (nicht reaktiv) zu erhalten
|
|
533
|
+
> - Verwenden Sie `.value`, um den reaktiven Wert zu erhalten
|
|
534
|
+
> - Verwenden Sie die Komponenten-Syntax `<content.key />` für die Unterstützung des Visual Editors
|
|
535
|
+
|
|
644
536
|
Erstellen Sie die entsprechende Inhaltsdeklaration:
|
|
645
537
|
|
|
646
|
-
```ts fileName="pages/about-
|
|
538
|
+
```ts fileName="pages/about-page.content.ts" contentDeclarationFormat="typescript"
|
|
647
539
|
import { t, type Dictionary } from "intlayer";
|
|
648
|
-
import type { useSeoMeta } from "nuxt/app";
|
|
649
540
|
|
|
650
|
-
const
|
|
651
|
-
key: "about-
|
|
541
|
+
const aboutPageContent = {
|
|
542
|
+
key: "about-page",
|
|
652
543
|
content: {
|
|
653
|
-
|
|
654
|
-
de: "Über Uns - Mein Unternehmen",
|
|
544
|
+
metaTitle: t({
|
|
655
545
|
en: "About Us - My Company",
|
|
656
546
|
fr: "À Propos - Ma Société",
|
|
657
547
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
658
548
|
}),
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
en: "Learn more about our company and our mission",
|
|
549
|
+
metaDescription: t({
|
|
550
|
+
en: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
662
551
|
fr: "En savoir plus sur notre société et notre mission",
|
|
663
552
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
664
553
|
}),
|
|
554
|
+
title: t({
|
|
555
|
+
en: "About Us",
|
|
556
|
+
fr: "À Propos",
|
|
557
|
+
es: "Acerca de Nosotros",
|
|
558
|
+
}),
|
|
665
559
|
},
|
|
666
|
-
} satisfies Dictionary
|
|
560
|
+
} satisfies Dictionary;
|
|
667
561
|
|
|
668
|
-
export default
|
|
562
|
+
export default aboutPageContent;
|
|
669
563
|
```
|
|
670
564
|
|
|
671
|
-
```
|
|
565
|
+
```javascript fileName="pages/about-page.content.mjs" contentDeclarationFormat="esm"
|
|
672
566
|
import { t } from "intlayer";
|
|
673
567
|
|
|
674
568
|
/** @type {import('intlayer').Dictionary} */
|
|
675
|
-
const
|
|
676
|
-
key: "about-
|
|
569
|
+
const aboutPageContent = {
|
|
570
|
+
key: "about-page",
|
|
677
571
|
content: {
|
|
678
|
-
|
|
679
|
-
zh: "关于我们 - 我的公司",
|
|
680
|
-
de: "Über uns - Mein Unternehmen",
|
|
572
|
+
metaTitle: t({
|
|
681
573
|
en: "About Us - My Company",
|
|
682
574
|
fr: "À Propos - Ma Société",
|
|
683
575
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
684
576
|
}),
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
de: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
688
|
-
en: "Learn more about our company and our mission",
|
|
577
|
+
metaDescription: t({
|
|
578
|
+
en: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
689
579
|
fr: "En savoir plus sur notre société et notre mission",
|
|
690
580
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
691
581
|
}),
|
|
582
|
+
title: t({
|
|
583
|
+
en: "Über uns",
|
|
584
|
+
fr: "À Propos",
|
|
585
|
+
es: "Acerca de Nosotros",
|
|
586
|
+
}),
|
|
692
587
|
},
|
|
693
588
|
};
|
|
694
589
|
|
|
695
|
-
export default
|
|
590
|
+
export default aboutPageContent;
|
|
696
591
|
```
|
|
697
592
|
|
|
698
|
-
```
|
|
593
|
+
```javascript fileName="pages/about-page.content.cjs" contentDeclarationFormat="commonjs"
|
|
699
594
|
const { t } = require("intlayer");
|
|
700
595
|
|
|
701
596
|
/** @type {import('intlayer').Dictionary} */
|
|
702
|
-
const
|
|
703
|
-
key: "about-
|
|
597
|
+
const aboutPageContent = {
|
|
598
|
+
key: "about-page",
|
|
704
599
|
content: {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
de: "Über uns - Mein Unternehmen",
|
|
708
|
-
en: "About Us - My Company",
|
|
600
|
+
metaTitle: t({
|
|
601
|
+
en: "Über uns - Mein Unternehmen",
|
|
709
602
|
fr: "À Propos - Ma Société",
|
|
710
603
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
711
604
|
}),
|
|
712
|
-
|
|
713
|
-
zh: "了解更多关于我们公司和我们的使命",
|
|
605
|
+
metaDescription: t({
|
|
714
606
|
en: "Learn more about our company and our mission",
|
|
715
607
|
fr: "En savoir plus sur notre société et notre mission",
|
|
716
608
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
717
|
-
|
|
609
|
+
}),
|
|
610
|
+
title: t({
|
|
611
|
+
en: "Über uns",
|
|
612
|
+
fr: "À Propos",
|
|
613
|
+
es: "Acerca de Nosotros",
|
|
718
614
|
}),
|
|
719
615
|
},
|
|
720
616
|
};
|
|
721
617
|
|
|
722
|
-
module.exports =
|
|
618
|
+
module.exports = aboutPageContent;
|
|
723
619
|
```
|
|
724
620
|
|
|
725
|
-
```json fileName="pages/about-
|
|
621
|
+
```json fileName="pages/about-page.content.json" contentDeclarationFormat="json"
|
|
726
622
|
{
|
|
727
|
-
"
|
|
623
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
624
|
+
"key": "about-page",
|
|
728
625
|
"content": {
|
|
729
|
-
"
|
|
626
|
+
"metaTitle": {
|
|
730
627
|
"nodeType": "translation",
|
|
731
|
-
"
|
|
732
|
-
"
|
|
733
|
-
"en": "About Us - My Company",
|
|
628
|
+
"translation": {
|
|
629
|
+
"en": "Über uns - Mein Unternehmen",
|
|
734
630
|
"fr": "À Propos - Ma Société",
|
|
735
|
-
"es": "Acerca de Nosotros - Mi Empresa"
|
|
736
|
-
"de": "Über uns - Mein Unternehmen"
|
|
631
|
+
"es": "Acerca de Nosotros - Mi Empresa"
|
|
737
632
|
}
|
|
738
633
|
},
|
|
739
|
-
"
|
|
634
|
+
"metaDescription": {
|
|
740
635
|
"nodeType": "translation",
|
|
741
|
-
"
|
|
742
|
-
"zh": "了解更多关于我们公司和我们的使命",
|
|
636
|
+
"translation": {
|
|
743
637
|
"en": "Learn more about our company and our mission",
|
|
744
638
|
"fr": "En savoir plus sur notre société et notre mission",
|
|
745
|
-
"es": "Conozca más sobre nuestra empresa y nuestra misión"
|
|
639
|
+
"es": "Conozca más sobre nuestra empresa y nuestra misión",
|
|
640
|
+
"de": "Erfahren Sie mehr über unser Unternehmen und unsere Mission"
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
"title": {
|
|
644
|
+
"nodeType": "translation",
|
|
645
|
+
"translation": {
|
|
646
|
+
"en": "About Us",
|
|
647
|
+
"fr": "À Propos",
|
|
648
|
+
"es": "Acerca de Nosotros",
|
|
649
|
+
"de": "Über Uns"
|
|
746
650
|
}
|
|
747
651
|
}
|
|
748
652
|
}
|
|
@@ -751,11 +655,11 @@ module.exports = aboutMetaContent;
|
|
|
751
655
|
|
|
752
656
|
### TypeScript konfigurieren
|
|
753
657
|
|
|
754
|
-
Intlayer verwendet Module Augmentation, um die Vorteile von TypeScript zu nutzen und
|
|
658
|
+
Intlayer verwendet Module Augmentation, um die Vorteile von TypeScript zu nutzen und Ihre Codebasis robuster zu machen.
|
|
755
659
|
|
|
756
|
-

|
|
757
661
|
|
|
758
|
-

|
|
759
663
|
|
|
760
664
|
Stellen Sie sicher, dass Ihre TypeScript-Konfiguration die automatisch generierten Typen einschließt.
|
|
761
665
|
|
|
@@ -764,7 +668,7 @@ Stellen Sie sicher, dass Ihre TypeScript-Konfiguration die automatisch generiert
|
|
|
764
668
|
// ... Ihre bestehenden TypeScript-Konfigurationen
|
|
765
669
|
"include": [
|
|
766
670
|
// ... Ihre bestehenden TypeScript-Konfigurationen
|
|
767
|
-
".intlayer/**/*.ts", //
|
|
671
|
+
".intlayer/**/*.ts", // Einschließen der automatisch generierten Typen
|
|
768
672
|
],
|
|
769
673
|
}
|
|
770
674
|
```
|
|
@@ -773,7 +677,7 @@ Stellen Sie sicher, dass Ihre TypeScript-Konfiguration die automatisch generiert
|
|
|
773
677
|
|
|
774
678
|
Es wird empfohlen, die von Intlayer generierten Dateien zu ignorieren. So vermeiden Sie, diese versehentlich in Ihr Git-Repository zu committen.
|
|
775
679
|
|
|
776
|
-
|
|
680
|
+
Fügen Sie dazu folgende Anweisungen in Ihre `.gitignore`-Datei ein:
|
|
777
681
|
|
|
778
682
|
```plaintext fileName=".gitignore"
|
|
779
683
|
# Ignoriere die von Intlayer generierten Dateien
|
|
@@ -793,12 +697,10 @@ Diese Erweiterung bietet:
|
|
|
793
697
|
- **Inline-Vorschauen** des übersetzten Inhalts.
|
|
794
698
|
- **Schnellaktionen**, um Übersetzungen einfach zu erstellen und zu aktualisieren.
|
|
795
699
|
|
|
796
|
-
Für weitere Details zur Verwendung der Erweiterung
|
|
700
|
+
Für weitere Details zur Verwendung der Erweiterung lesen Sie bitte die [Intlayer VS Code Erweiterungsdokumentation](https://intlayer.org/doc/vs-code-extension).
|
|
797
701
|
|
|
798
702
|
---
|
|
799
703
|
|
|
800
704
|
### Weiterführende Schritte
|
|
801
705
|
|
|
802
|
-
Um weiterzugehen, können Sie den [visuellen Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_visual_editor.md) implementieren oder Ihre Inhalte mit dem [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_CMS.md)
|
|
803
|
-
|
|
804
|
-
---
|
|
706
|
+
Um weiterzugehen, können Sie den [visuellen Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_visual_editor.md) implementieren oder Ihre Inhalte mit dem [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_CMS.md) auslagern.
|