@intlayer/docs 7.3.11 → 7.3.13
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 +294 -438
- 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 +284 -410
- 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 +237 -341
- 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 +254 -378
- 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 +271 -390
- 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 +278 -405
- 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 +303 -447
- 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 +266 -395
- 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 +299 -423
- 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 +309 -432
- 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 +295 -422
- 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 +273 -476
- 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 +277 -420
- 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 +287 -425
- 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 +313 -406
- 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 +273 -418
- 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 +300 -461
- 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 +10 -11
- 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,32 +14,59 @@ 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=nhUcUAVQ6eQ
|
|
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
|
+
<Tab defaultTab="video">
|
|
50
|
+
<TabItem label="Video" value="video">
|
|
51
|
+
|
|
52
|
+
<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/nhUcUAVQ6eQ?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
53
|
+
|
|
54
|
+
</TabItem>
|
|
55
|
+
<TabItem label="Code" value="code">
|
|
56
|
+
|
|
57
|
+
<iframe
|
|
58
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-nuxt-4-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
59
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
60
|
+
title="Demo CodeSandbox - Wie Sie Ihre Anwendung mit Intlayer internationalisieren"
|
|
61
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
62
|
+
loading="lazy"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
</TabItem>
|
|
66
|
+
</Tab>
|
|
67
|
+
|
|
68
|
+
Siehe [Application Template](https://github.com/aymericzip/intlayer-nuxt-4-template) auf GitHub.
|
|
69
|
+
|
|
43
70
|
### Schritt 1: Abhängigkeiten installieren
|
|
44
71
|
|
|
45
72
|
Installieren Sie die notwendigen Pakete mit npm:
|
|
@@ -61,13 +88,13 @@ yarn add --save-dev nuxt-intlayer
|
|
|
61
88
|
|
|
62
89
|
- **intlayer**
|
|
63
90
|
|
|
64
|
-
Das Kernpaket, das Internationalisierungswerkzeuge für Konfigurationsmanagement, Übersetzung, [Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/
|
|
91
|
+
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
92
|
|
|
66
93
|
- **vue-intlayer**
|
|
67
94
|
Das Paket, das Intlayer in Vue-Anwendungen integriert. Es stellt die Composables für die Vue-Komponenten bereit.
|
|
68
95
|
|
|
69
96
|
- **nuxt-intlayer**
|
|
70
|
-
Das Nuxt-Modul, das Intlayer
|
|
97
|
+
Das Nuxt-Modul, das Intlayer mit Nuxt-Anwendungen integriert. Es bietet automatische Einrichtung, Middleware zur Lokalerkennung, Cookie-Verwaltung und URL-Weiterleitung.
|
|
71
98
|
|
|
72
99
|
### Schritt 2: Konfiguration Ihres Projekts
|
|
73
100
|
|
|
@@ -86,9 +113,6 @@ const config: IntlayerConfig = {
|
|
|
86
113
|
],
|
|
87
114
|
defaultLocale: Locales.ENGLISH,
|
|
88
115
|
},
|
|
89
|
-
content: {
|
|
90
|
-
contentDir: ["."], // Da Intlayer standardmäßig Inhaltsdeklarationsdateien aus dem Verzeichnis `./src` überwacht
|
|
91
|
-
},
|
|
92
116
|
};
|
|
93
117
|
|
|
94
118
|
export default config;
|
|
@@ -98,7 +122,6 @@ export default config;
|
|
|
98
122
|
import { Locales } from "intlayer";
|
|
99
123
|
|
|
100
124
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
101
|
-
// Konfiguration für die Internationalisierung und Inhaltsverzeichnis
|
|
102
125
|
const config = {
|
|
103
126
|
internationalization: {
|
|
104
127
|
locales: [
|
|
@@ -109,9 +132,6 @@ const config = {
|
|
|
109
132
|
],
|
|
110
133
|
defaultLocale: Locales.ENGLISH,
|
|
111
134
|
},
|
|
112
|
-
content: {
|
|
113
|
-
contentDir: ["."], // Verzeichnis für Inhaltsdeklarationen
|
|
114
|
-
},
|
|
115
135
|
};
|
|
116
136
|
|
|
117
137
|
export default config;
|
|
@@ -121,7 +141,6 @@ export default config;
|
|
|
121
141
|
const { Locales } = require("intlayer");
|
|
122
142
|
|
|
123
143
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
124
|
-
// Konfiguration für die Internationalisierung und Inhaltsverzeichnis
|
|
125
144
|
const config = {
|
|
126
145
|
internationalization: {
|
|
127
146
|
locales: [
|
|
@@ -132,15 +151,12 @@ const config = {
|
|
|
132
151
|
],
|
|
133
152
|
defaultLocale: Locales.ENGLISH,
|
|
134
153
|
},
|
|
135
|
-
content: {
|
|
136
|
-
contentDir: ["."],
|
|
137
|
-
},
|
|
138
154
|
};
|
|
139
155
|
|
|
140
156
|
module.exports = config;
|
|
141
157
|
```
|
|
142
158
|
|
|
143
|
-
> Durch diese Konfigurationsdatei können Sie lokalisierte URLs, Middleware-Weiterleitungen, Cookie-Namen, den Speicherort und die Erweiterung Ihrer Inhaltsdeklarationen einrichten, Intlayer-
|
|
159
|
+
> 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
160
|
|
|
145
161
|
### Schritt 3: Integrieren Sie Intlayer in Ihre Nuxt-Konfiguration
|
|
146
162
|
|
|
@@ -155,225 +171,44 @@ export default defineNuxtConfig({
|
|
|
155
171
|
});
|
|
156
172
|
```
|
|
157
173
|
|
|
158
|
-
> Das `nuxt-intlayer`-Modul übernimmt automatisch die Integration von Intlayer
|
|
174
|
+
> 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
175
|
|
|
160
176
|
### Schritt 4: Deklarieren Sie Ihre Inhalte
|
|
161
177
|
|
|
162
178
|
Erstellen und verwalten Sie Ihre Inhaltsdeklarationen, um Übersetzungen zu speichern:
|
|
163
179
|
|
|
164
|
-
```tsx fileName="
|
|
165
|
-
import {
|
|
180
|
+
```tsx fileName="content/home-page.content.ts" contentDeclarationFormat="typescript"
|
|
181
|
+
import { type Dictionary, t } from "intlayer";
|
|
166
182
|
|
|
167
|
-
const
|
|
168
|
-
key: "
|
|
183
|
+
const content = {
|
|
184
|
+
key: "home-page",
|
|
169
185
|
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",
|
|
186
|
+
title: t({
|
|
187
|
+
en: "Hello world",
|
|
188
|
+
fr: "Bonjour le monde",
|
|
189
|
+
es: "Hola mundo",
|
|
191
190
|
}),
|
|
192
|
-
|
|
193
|
-
en: "
|
|
194
|
-
fr: "
|
|
195
|
-
es: "
|
|
191
|
+
metaTitle: t({
|
|
192
|
+
en: "Welcome | My Application",
|
|
193
|
+
fr: "Bienvenue | Mon Application",
|
|
194
|
+
es: "Bienvenido | Mi Aplicación",
|
|
196
195
|
}),
|
|
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",
|
|
196
|
+
metaDescription: t({
|
|
197
|
+
en: "Entdecken Sie die mehrsprachige Startseite Ihrer Nuxt-App, die von Intlayer unterstützt wird.",
|
|
198
|
+
fr: "Découvrez la page d'accueil multilingue de votre application Nuxt propulsée par Intlayer.",
|
|
199
|
+
es: "Descubre la página de inicio multilingüe de tu aplicación Nuxt impulsada por Intlayer.",
|
|
203
200
|
}),
|
|
204
201
|
},
|
|
205
202
|
} satisfies Dictionary;
|
|
206
203
|
|
|
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
|
-
}
|
|
204
|
+
export default content;
|
|
370
205
|
```
|
|
371
206
|
|
|
372
207
|
> 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
208
|
|
|
374
|
-
> Für weitere Details siehe die [Dokumentation zur Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/
|
|
209
|
+
> Für weitere Details siehe die [Dokumentation zur Inhaltsdeklaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/dictionary/content_file.md).
|
|
375
210
|
|
|
376
|
-
### Schritt 5:
|
|
211
|
+
### Schritt 5: Intlayer in Ihrem Code verwenden
|
|
377
212
|
|
|
378
213
|
Greifen Sie in Ihrer gesamten Nuxt-Anwendung mit dem Composable `useIntlayer` auf Ihre Inhaltswörterbücher zu:
|
|
379
214
|
|
|
@@ -428,82 +263,72 @@ const countRef = ref(0);
|
|
|
428
263
|
|
|
429
264
|
Intlayer bietet verschiedene APIs, um auf Ihre Inhalte zuzugreifen:
|
|
430
265
|
|
|
431
|
-
- **Komponentenbasierte Syntax** (empfohlen):
|
|
432
|
-
Verwenden Sie die Syntax `<myContent />` oder `<Component :is="myContent" />`, um Inhalte als Intlayer-Knoten
|
|
266
|
+
- **Komponentenbasierte Syntax** (empfohlen):
|
|
267
|
+
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
268
|
|
|
434
|
-
- **String-basierte Syntax**:
|
|
435
|
-
Verwenden Sie `{{ myContent }}`, um den Inhalt als
|
|
269
|
+
- **String-basierte Syntax**:
|
|
270
|
+
Verwenden Sie `{{ myContent }}`, um den Inhalt als einfachen Text ohne Unterstützung des Visual Editors darzustellen.
|
|
436
271
|
|
|
437
|
-
- **Raw-HTML-Syntax**:
|
|
272
|
+
- **Raw-HTML-Syntax**:
|
|
438
273
|
Verwenden Sie `<div v-html="myContent" />`, um den Inhalt als rohes HTML ohne Unterstützung des Visual Editors darzustellen.
|
|
439
274
|
|
|
440
|
-
- **Destrukturierungssyntax**:
|
|
441
|
-
Der `useIntlayer` Composable gibt ein Proxy-Objekt mit dem Inhalt zurück. Dieses Proxy
|
|
275
|
+
- **Destrukturierungssyntax**:
|
|
276
|
+
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
277
|
- Verwenden Sie `const content = useIntlayer("myContent");` und `{{ content.myContent }}` / `<content.myContent />`.
|
|
443
|
-
- Oder verwenden Sie `const { myContent } = useIntlayer("myContent");` und `{{ myContent
|
|
278
|
+
- Oder verwenden Sie `const { myContent } = useIntlayer("myContent");` und `{{ myContent}}` / `<myContent/>`, um den Inhalt zu destrukturieren.
|
|
444
279
|
|
|
445
280
|
### (Optional) Schritt 6: Ändern Sie die Sprache Ihres Inhalts
|
|
446
281
|
|
|
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
|
|
282
|
+
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
283
|
|
|
449
|
-
Erstellen Sie eine Komponente, um zwischen
|
|
284
|
+
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
285
|
|
|
451
286
|
```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
287
|
<script setup lang="ts">
|
|
463
|
-
import {
|
|
464
|
-
import { getLocaleName } from "intlayer";
|
|
288
|
+
import { getLocaleName, getLocalizedUrl } from "intlayer";
|
|
465
289
|
import { useLocale } from "vue-intlayer";
|
|
466
290
|
|
|
467
|
-
//
|
|
291
|
+
// Nuxt importiert useRoute automatisch
|
|
292
|
+
const route = useRoute();
|
|
468
293
|
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
294
|
</script>
|
|
295
|
+
|
|
296
|
+
<template>
|
|
297
|
+
<nav class="locale-switcher">
|
|
298
|
+
<NuxtLink
|
|
299
|
+
v-for="localeEl in availableLocales"
|
|
300
|
+
:key="localeEl"
|
|
301
|
+
:to="getLocalizedUrl(route.fullPath, localeEl)"
|
|
302
|
+
class="locale-link"
|
|
303
|
+
:class="{ 'active-locale': localeEl === locale }"
|
|
304
|
+
@click="setLocale(localeEl)"
|
|
305
|
+
>
|
|
306
|
+
{{ getLocaleName(localeEl) }}
|
|
307
|
+
</NuxtLink>
|
|
308
|
+
</nav>
|
|
484
309
|
</template>
|
|
310
|
+
```
|
|
485
311
|
|
|
486
|
-
|
|
487
|
-
.locale-switcher {
|
|
488
|
-
margin: 1rem 0;
|
|
489
|
-
}
|
|
312
|
+
> 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
313
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
314
|
+
Richten Sie anschließend Ihre `app.vue` so ein, dass Layouts verwendet werden:
|
|
315
|
+
|
|
316
|
+
```vue fileName="app.vue"
|
|
317
|
+
<template>
|
|
318
|
+
<NuxtLayout>
|
|
319
|
+
<NuxtPage />
|
|
320
|
+
</NuxtLayout>
|
|
321
|
+
</template>
|
|
497
322
|
```
|
|
498
323
|
|
|
499
|
-
|
|
324
|
+
### (Optional) Schritt 6b: Erstellen Sie ein Layout mit Navigation
|
|
500
325
|
|
|
501
|
-
|
|
326
|
+
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:
|
|
327
|
+
|
|
328
|
+
```vue fileName="layouts/default.vue"
|
|
502
329
|
<script setup lang="ts">
|
|
503
|
-
import
|
|
330
|
+
import Links from "~/components/Links.vue";
|
|
504
331
|
import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
|
|
505
|
-
|
|
506
|
-
const content = useIntlayer("app"); // Erstellen Sie die zugehörige Intlayer-Deklarationsdatei
|
|
507
332
|
</script>
|
|
508
333
|
|
|
509
334
|
<template>
|
|
@@ -512,15 +337,20 @@ const content = useIntlayer("app"); // Erstellen Sie die zugehörige Intlayer-De
|
|
|
512
337
|
<LocaleSwitcher />
|
|
513
338
|
</header>
|
|
514
339
|
<main>
|
|
515
|
-
<
|
|
340
|
+
<slot />
|
|
516
341
|
</main>
|
|
342
|
+
|
|
343
|
+
<Links href="/">Startseite</Links>
|
|
344
|
+
<Links href="/about">Über</Links>
|
|
517
345
|
</div>
|
|
518
346
|
</template>
|
|
519
347
|
```
|
|
520
348
|
|
|
521
|
-
|
|
349
|
+
Die `Links`-Komponente (siehe unten) stellt sicher, dass interne Navigationslinks automatisch lokalisiert werden.
|
|
350
|
+
|
|
351
|
+
### (Optional) Schritt 7: Lokalisierte Routen zu Ihrer Anwendung hinzufügen
|
|
522
352
|
|
|
523
|
-
Nuxt verwaltet
|
|
353
|
+
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
354
|
|
|
525
355
|
Beispiel:
|
|
526
356
|
|
|
@@ -532,248 +362,294 @@ pages/
|
|
|
532
362
|
└── index.vue → /contact, /fr/contact, /es/contact
|
|
533
363
|
```
|
|
534
364
|
|
|
535
|
-
Um
|
|
365
|
+
Um lokalisierte Seiten zu erstellen, legen Sie einfach Ihre Vue-Dateien im Verzeichnis `pages/` an. Hier sind zwei Beispielseiten:
|
|
536
366
|
|
|
537
|
-
|
|
367
|
+
**Startseite (`pages/index.vue`):**
|
|
368
|
+
|
|
369
|
+
```vue fileName="pages/index.vue"
|
|
538
370
|
<script setup lang="ts">
|
|
539
371
|
import { useIntlayer } from "vue-intlayer";
|
|
540
372
|
|
|
541
|
-
const content = useIntlayer("
|
|
373
|
+
const content = useIntlayer("home-page");
|
|
374
|
+
|
|
375
|
+
useHead({
|
|
376
|
+
title: content.metaTitle.value,
|
|
377
|
+
meta: [
|
|
378
|
+
{
|
|
379
|
+
name: "description",
|
|
380
|
+
content: content.metaDescription.value,
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
});
|
|
542
384
|
</script>
|
|
543
385
|
|
|
544
386
|
<template>
|
|
545
|
-
<
|
|
546
|
-
<h1>{{ content.title }}</h1>
|
|
547
|
-
<p>{{ content.description }}</p>
|
|
548
|
-
</div>
|
|
387
|
+
<h1><content.title /></h1>
|
|
549
388
|
</template>
|
|
550
389
|
```
|
|
551
390
|
|
|
552
|
-
|
|
391
|
+
**Über-Seite (`pages/about.vue`):**
|
|
553
392
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
- Verwaltung von Sprach-Cookies
|
|
558
|
-
- Weiterleitung der Benutzer zur entsprechenden lokalisierten URL
|
|
393
|
+
```vue fileName="pages/about.vue"
|
|
394
|
+
<script setup lang="ts">
|
|
395
|
+
import { useIntlayer } from "vue-intlayer";
|
|
559
396
|
|
|
560
|
-
|
|
397
|
+
const content = useIntlayer("about-page");
|
|
561
398
|
|
|
562
|
-
|
|
399
|
+
useHead({
|
|
400
|
+
title: content.metaTitle.raw, // Verwenden Sie .raw für den Zugriff auf primitive Strings
|
|
401
|
+
meta: [
|
|
402
|
+
{
|
|
403
|
+
name: "description",
|
|
404
|
+
content: content.metaDescription.raw, // Verwenden Sie .raw für den Zugriff auf primitive Strings
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
});
|
|
408
|
+
</script>
|
|
563
409
|
|
|
564
|
-
```vue fileName="components/LocalizedLink.vue"
|
|
565
410
|
<template>
|
|
566
|
-
<
|
|
567
|
-
<slot />
|
|
568
|
-
</NuxtLink>
|
|
411
|
+
<h1><content.title /></h1>
|
|
569
412
|
</template>
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
> Hinweis: `useHead` wird in Nuxt automatisch importiert. Sie können auf Inhaltswerte entweder mit `.value` (reaktiv) oder `.raw` (primitiver String) je nach Bedarf zugreifen.
|
|
416
|
+
|
|
417
|
+
Das `nuxt-intlayer`-Modul wird automatisch:
|
|
418
|
+
|
|
419
|
+
- Die bevorzugte Sprache des Benutzers erkennen
|
|
420
|
+
- Die Sprachumschaltung über die URL handhaben
|
|
421
|
+
- Das passende `<html lang="">` Attribut setzen
|
|
422
|
+
- Sprach-Cookies verwalten
|
|
423
|
+
- Benutzer zur entsprechenden lokalisierten URL weiterleiten
|
|
424
|
+
|
|
425
|
+
### (Optional) Schritt 8: Erstellen einer lokalisierten Link-Komponente
|
|
426
|
+
|
|
427
|
+
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.
|
|
570
428
|
|
|
429
|
+
```vue fileName="components/Links.vue"
|
|
571
430
|
<script setup lang="ts">
|
|
572
|
-
import { computed } from "vue";
|
|
573
431
|
import { getLocalizedUrl } from "intlayer";
|
|
574
432
|
import { useLocale } from "vue-intlayer";
|
|
575
433
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
},
|
|
581
|
-
});
|
|
434
|
+
interface Props {
|
|
435
|
+
href: string;
|
|
436
|
+
locale?: string;
|
|
437
|
+
}
|
|
582
438
|
|
|
583
|
-
const
|
|
439
|
+
const props = defineProps<Props>();
|
|
584
440
|
|
|
585
|
-
|
|
586
|
-
const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
|
|
441
|
+
const { locale: currentLocale } = useLocale();
|
|
587
442
|
|
|
588
|
-
//
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
);
|
|
443
|
+
// Berechnet den finalen Pfad
|
|
444
|
+
const finalPath = computed(() => {
|
|
445
|
+
// 1. Prüfen, ob der Link extern ist
|
|
446
|
+
const isExternal = /^https?:\/\//.test(props.href || "");
|
|
447
|
+
|
|
448
|
+
// 2. Wenn extern, unverändert zurückgeben (NuxtLink übernimmt die <a>-Tag-Erzeugung)
|
|
449
|
+
if (isExternal) return props.href;
|
|
450
|
+
|
|
451
|
+
// 3. Wenn intern, URL lokalisieren
|
|
452
|
+
const targetLocale = props.locale || currentLocale.value;
|
|
453
|
+
return getLocalizedUrl(props.href, targetLocale);
|
|
454
|
+
});
|
|
592
455
|
</script>
|
|
456
|
+
|
|
457
|
+
<template>
|
|
458
|
+
<NuxtLink :to="finalPath" v-bind="$attrs">
|
|
459
|
+
<slot />
|
|
460
|
+
</NuxtLink>
|
|
461
|
+
</template>
|
|
593
462
|
```
|
|
594
463
|
|
|
595
|
-
|
|
464
|
+
Verwenden Sie dann diese Komponente in Ihrer gesamten Anwendung:
|
|
465
|
+
|
|
466
|
+
```vue fileName="layouts/default.vue"
|
|
467
|
+
<script setup lang="ts">
|
|
468
|
+
import Links from "~/components/Links.vue";
|
|
469
|
+
import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
|
|
470
|
+
</script>
|
|
596
471
|
|
|
597
|
-
```vue fileName="pages/index.vue"
|
|
598
472
|
<template>
|
|
599
473
|
<div>
|
|
600
|
-
<
|
|
601
|
-
|
|
602
|
-
</
|
|
603
|
-
<
|
|
604
|
-
|
|
605
|
-
</
|
|
474
|
+
<header>
|
|
475
|
+
<LocaleSwitcher />
|
|
476
|
+
</header>
|
|
477
|
+
<main>
|
|
478
|
+
<slot />
|
|
479
|
+
</main>
|
|
480
|
+
|
|
481
|
+
<Links href="/">Startseite</Links>
|
|
482
|
+
<Links href="/about">Über</Links>
|
|
606
483
|
</div>
|
|
607
484
|
</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
485
|
```
|
|
616
486
|
|
|
487
|
+
> Durch die Verwendung von `NuxtLink` mit lokalisierten Pfaden stellen Sie sicher, dass:
|
|
488
|
+
>
|
|
489
|
+
> - Suchmaschinen alle Sprachversionen Ihrer Seiten crawlen und indexieren können
|
|
490
|
+
> - Benutzer lokalisierten URLs direkt teilen können
|
|
491
|
+
> - Der Browserverlauf korrekt mit sprachpräfixierten URLs funktioniert
|
|
492
|
+
|
|
617
493
|
### (Optional) Schritt 9: Metadaten und SEO verwalten
|
|
618
494
|
|
|
619
|
-
Nuxt bietet hervorragende SEO-Fähigkeiten. Sie können Intlayer verwenden, um lokalisierte Metadaten zu verwalten:
|
|
495
|
+
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
496
|
|
|
621
497
|
```vue fileName="pages/about.vue"
|
|
622
498
|
<script setup lang="ts">
|
|
623
|
-
import {
|
|
624
|
-
import { getIntlayer } from "intlayer";
|
|
625
|
-
import { useLocale } from "vue-intlayer";
|
|
499
|
+
import { useIntlayer } from "vue-intlayer";
|
|
626
500
|
|
|
627
|
-
|
|
628
|
-
const content =
|
|
501
|
+
// useHead wird in Nuxt automatisch importiert
|
|
502
|
+
const content = useIntlayer("about-page");
|
|
629
503
|
|
|
630
|
-
|
|
631
|
-
title: content.
|
|
632
|
-
|
|
504
|
+
useHead({
|
|
505
|
+
title: content.metaTitle.raw, // Verwenden Sie .raw für den Zugriff auf den primitiven String
|
|
506
|
+
meta: [
|
|
507
|
+
{
|
|
508
|
+
name: "description",
|
|
509
|
+
content: content.metaDescription.raw, // Verwenden Sie .raw für den Zugriff auf den primitiven Stringwert
|
|
510
|
+
},
|
|
511
|
+
],
|
|
633
512
|
});
|
|
634
513
|
</script>
|
|
635
514
|
|
|
636
515
|
<template>
|
|
637
|
-
<
|
|
638
|
-
<h1>{{ content.pageTitle }}</h1>
|
|
639
|
-
<p>{{ content.pageContent }}</p>
|
|
640
|
-
</div>
|
|
516
|
+
<h1><content.title /></h1>
|
|
641
517
|
</template>
|
|
642
518
|
```
|
|
643
519
|
|
|
520
|
+
> Alternativ können Sie die Funktion `import { getIntlayer } from "intlayer"` verwenden, um den Inhalt ohne Vue-Reaktivität zu erhalten.
|
|
521
|
+
|
|
522
|
+
> **Zugriff auf Inhaltswerte:**
|
|
523
|
+
>
|
|
524
|
+
> - Verwenden Sie `.raw`, um den primitiven Stringwert (nicht reaktiv) zu erhalten
|
|
525
|
+
> - Verwenden Sie `.value`, um den reaktiven Wert zu erhalten
|
|
526
|
+
> - Verwenden Sie die Komponenten-Syntax `<content.key />` für die Unterstützung des Visual Editors
|
|
527
|
+
|
|
644
528
|
Erstellen Sie die entsprechende Inhaltsdeklaration:
|
|
645
529
|
|
|
646
|
-
```ts fileName="pages/about-
|
|
530
|
+
```ts fileName="pages/about-page.content.ts" contentDeclarationFormat="typescript"
|
|
647
531
|
import { t, type Dictionary } from "intlayer";
|
|
648
|
-
import type { useSeoMeta } from "nuxt/app";
|
|
649
532
|
|
|
650
|
-
const
|
|
651
|
-
key: "about-
|
|
533
|
+
const aboutPageContent = {
|
|
534
|
+
key: "about-page",
|
|
652
535
|
content: {
|
|
653
|
-
|
|
654
|
-
de: "Über Uns - Mein Unternehmen",
|
|
536
|
+
metaTitle: t({
|
|
655
537
|
en: "About Us - My Company",
|
|
656
538
|
fr: "À Propos - Ma Société",
|
|
657
539
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
658
540
|
}),
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
en: "Learn more about our company and our mission",
|
|
541
|
+
metaDescription: t({
|
|
542
|
+
en: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
662
543
|
fr: "En savoir plus sur notre société et notre mission",
|
|
663
544
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
664
545
|
}),
|
|
546
|
+
title: t({
|
|
547
|
+
en: "About Us",
|
|
548
|
+
fr: "À Propos",
|
|
549
|
+
es: "Acerca de Nosotros",
|
|
550
|
+
}),
|
|
665
551
|
},
|
|
666
|
-
} satisfies Dictionary
|
|
552
|
+
} satisfies Dictionary;
|
|
667
553
|
|
|
668
|
-
export default
|
|
554
|
+
export default aboutPageContent;
|
|
669
555
|
```
|
|
670
556
|
|
|
671
|
-
```
|
|
557
|
+
```javascript fileName="pages/about-page.content.mjs" contentDeclarationFormat="esm"
|
|
672
558
|
import { t } from "intlayer";
|
|
673
559
|
|
|
674
560
|
/** @type {import('intlayer').Dictionary} */
|
|
675
|
-
const
|
|
676
|
-
key: "about-
|
|
561
|
+
const aboutPageContent = {
|
|
562
|
+
key: "about-page",
|
|
677
563
|
content: {
|
|
678
|
-
|
|
679
|
-
zh: "关于我们 - 我的公司",
|
|
680
|
-
de: "Über uns - Mein Unternehmen",
|
|
564
|
+
metaTitle: t({
|
|
681
565
|
en: "About Us - My Company",
|
|
682
566
|
fr: "À Propos - Ma Société",
|
|
683
567
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
684
568
|
}),
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
de: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
688
|
-
en: "Learn more about our company and our mission",
|
|
569
|
+
metaDescription: t({
|
|
570
|
+
en: "Erfahren Sie mehr über unser Unternehmen und unsere Mission",
|
|
689
571
|
fr: "En savoir plus sur notre société et notre mission",
|
|
690
572
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
691
573
|
}),
|
|
574
|
+
title: t({
|
|
575
|
+
en: "Über uns",
|
|
576
|
+
fr: "À Propos",
|
|
577
|
+
es: "Acerca de Nosotros",
|
|
578
|
+
}),
|
|
692
579
|
},
|
|
693
580
|
};
|
|
694
581
|
|
|
695
|
-
export default
|
|
582
|
+
export default aboutPageContent;
|
|
696
583
|
```
|
|
697
584
|
|
|
698
|
-
```
|
|
585
|
+
```javascript fileName="pages/about-page.content.cjs" contentDeclarationFormat="commonjs"
|
|
699
586
|
const { t } = require("intlayer");
|
|
700
587
|
|
|
701
588
|
/** @type {import('intlayer').Dictionary} */
|
|
702
|
-
const
|
|
703
|
-
key: "about-
|
|
589
|
+
const aboutPageContent = {
|
|
590
|
+
key: "about-page",
|
|
704
591
|
content: {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
de: "Über uns - Mein Unternehmen",
|
|
708
|
-
en: "About Us - My Company",
|
|
592
|
+
metaTitle: t({
|
|
593
|
+
en: "Über uns - Mein Unternehmen",
|
|
709
594
|
fr: "À Propos - Ma Société",
|
|
710
595
|
es: "Acerca de Nosotros - Mi Empresa",
|
|
711
596
|
}),
|
|
712
|
-
|
|
713
|
-
zh: "了解更多关于我们公司和我们的使命",
|
|
597
|
+
metaDescription: t({
|
|
714
598
|
en: "Learn more about our company and our mission",
|
|
715
599
|
fr: "En savoir plus sur notre société et notre mission",
|
|
716
600
|
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
717
|
-
|
|
601
|
+
}),
|
|
602
|
+
title: t({
|
|
603
|
+
en: "Über uns",
|
|
604
|
+
fr: "À Propos",
|
|
605
|
+
es: "Acerca de Nosotros",
|
|
718
606
|
}),
|
|
719
607
|
},
|
|
720
608
|
};
|
|
721
609
|
|
|
722
|
-
module.exports =
|
|
610
|
+
module.exports = aboutPageContent;
|
|
723
611
|
```
|
|
724
612
|
|
|
725
|
-
```json fileName="pages/about-
|
|
613
|
+
```json fileName="pages/about-page.content.json" contentDeclarationFormat="json"
|
|
726
614
|
{
|
|
727
|
-
"
|
|
615
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
616
|
+
"key": "about-page",
|
|
728
617
|
"content": {
|
|
729
|
-
"
|
|
618
|
+
"metaTitle": {
|
|
730
619
|
"nodeType": "translation",
|
|
731
|
-
"
|
|
732
|
-
"
|
|
733
|
-
"en": "About Us - My Company",
|
|
620
|
+
"translation": {
|
|
621
|
+
"en": "Über uns - Mein Unternehmen",
|
|
734
622
|
"fr": "À Propos - Ma Société",
|
|
735
|
-
"es": "Acerca de Nosotros - Mi Empresa"
|
|
736
|
-
"de": "Über uns - Mein Unternehmen"
|
|
623
|
+
"es": "Acerca de Nosotros - Mi Empresa"
|
|
737
624
|
}
|
|
738
625
|
},
|
|
739
|
-
"
|
|
626
|
+
"metaDescription": {
|
|
740
627
|
"nodeType": "translation",
|
|
741
|
-
"
|
|
742
|
-
"zh": "了解更多关于我们公司和我们的使命",
|
|
628
|
+
"translation": {
|
|
743
629
|
"en": "Learn more about our company and our mission",
|
|
744
630
|
"fr": "En savoir plus sur notre société et notre mission",
|
|
745
|
-
"es": "Conozca más sobre nuestra empresa y nuestra misión"
|
|
631
|
+
"es": "Conozca más sobre nuestra empresa y nuestra misión",
|
|
632
|
+
"de": "Erfahren Sie mehr über unser Unternehmen und unsere Mission"
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
"title": {
|
|
636
|
+
"nodeType": "translation",
|
|
637
|
+
"translation": {
|
|
638
|
+
"en": "About Us",
|
|
639
|
+
"fr": "À Propos",
|
|
640
|
+
"es": "Acerca de Nosotros",
|
|
641
|
+
"de": "Über Uns"
|
|
746
642
|
}
|
|
747
643
|
}
|
|
748
644
|
}
|
|
749
645
|
}
|
|
750
646
|
```
|
|
751
647
|
|
|
752
|
-
### TypeScript konfigurieren
|
|
753
|
-
|
|
754
|
-
Intlayer verwendet Module Augmentation, um die Vorteile von TypeScript zu nutzen und Ihren Code robuster zu machen.
|
|
755
|
-
|
|
756
|
-

|
|
757
|
-
|
|
758
|
-

|
|
759
|
-
|
|
760
|
-
Stellen Sie sicher, dass Ihre TypeScript-Konfiguration die automatisch generierten Typen einschließt.
|
|
761
|
-
|
|
762
|
-
```json5 fileName="tsconfig.json"
|
|
763
|
-
{
|
|
764
|
-
// ... Ihre bestehenden TypeScript-Konfigurationen
|
|
765
|
-
"include": [
|
|
766
|
-
// ... Ihre bestehenden TypeScript-Konfigurationen
|
|
767
|
-
".intlayer/**/*.ts", // Einschluss der automatisch generierten Typen
|
|
768
|
-
],
|
|
769
|
-
}
|
|
770
|
-
```
|
|
771
|
-
|
|
772
648
|
### Git-Konfiguration
|
|
773
649
|
|
|
774
650
|
Es wird empfohlen, die von Intlayer generierten Dateien zu ignorieren. So vermeiden Sie, diese versehentlich in Ihr Git-Repository zu committen.
|
|
775
651
|
|
|
776
|
-
|
|
652
|
+
Fügen Sie dazu folgende Anweisungen in Ihre `.gitignore`-Datei ein:
|
|
777
653
|
|
|
778
654
|
```plaintext fileName=".gitignore"
|
|
779
655
|
# Ignoriere die von Intlayer generierten Dateien
|
|
@@ -793,12 +669,10 @@ Diese Erweiterung bietet:
|
|
|
793
669
|
- **Inline-Vorschauen** des übersetzten Inhalts.
|
|
794
670
|
- **Schnellaktionen**, um Übersetzungen einfach zu erstellen und zu aktualisieren.
|
|
795
671
|
|
|
796
|
-
Für weitere Details zur Verwendung der Erweiterung
|
|
672
|
+
Für weitere Details zur Verwendung der Erweiterung lesen Sie bitte die [Intlayer VS Code Erweiterungsdokumentation](https://intlayer.org/doc/vs-code-extension).
|
|
797
673
|
|
|
798
674
|
---
|
|
799
675
|
|
|
800
676
|
### Weiterführende Schritte
|
|
801
677
|
|
|
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
|
-
---
|
|
678
|
+
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.
|