@intlayer/docs 5.5.9 → 5.5.10
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/ar/autoFill.md +1 -2
- package/ar/intlayer_with_create_react_app.md +1 -14
- package/ar/intlayer_with_nextjs_14.md +1 -14
- package/ar/intlayer_with_nextjs_15.md +1 -14
- package/ar/intlayer_with_nextjs_page_router.md +1 -13
- package/ar/intlayer_with_nuxt.md +792 -0
- package/ar/intlayer_with_react_native+expo.md +6 -3
- package/ar/intlayer_with_vite+preact.md +7 -18
- package/ar/intlayer_with_vite+react.md +7 -17
- package/ar/intlayer_with_vite+vue.md +25 -5
- package/ar/packages/nuxt-intlayer/index.md +29 -0
- package/ar/roadmap.md +11 -11
- package/de/autoFill.md +1 -2
- package/de/how_works_intlayer.md +1 -1
- package/de/intlayer_with_create_react_app.md +1 -14
- package/de/intlayer_with_nextjs_14.md +1 -14
- package/de/intlayer_with_nextjs_15.md +1 -14
- package/de/intlayer_with_nextjs_page_router.md +1 -13
- package/de/intlayer_with_nuxt.md +791 -0
- package/de/intlayer_with_react_native+expo.md +6 -3
- package/de/intlayer_with_vite+preact.md +7 -18
- package/de/intlayer_with_vite+react.md +7 -17
- package/de/intlayer_with_vite+vue.md +84 -62
- package/de/packages/nuxt-intlayer/index.md +29 -0
- package/de/roadmap.md +11 -11
- package/en/autoFill.md +1 -2
- package/en/how_works_intlayer.md +17 -3
- package/en/intlayer_with_angular.md +535 -6
- package/en/intlayer_with_create_react_app.md +1 -14
- package/en/intlayer_with_nextjs_14.md +193 -59
- package/en/intlayer_with_nextjs_15.md +192 -61
- package/en/intlayer_with_nextjs_page_router.md +396 -61
- package/en/intlayer_with_nuxt.md +737 -0
- package/en/intlayer_with_react_native+expo.md +6 -3
- package/en/intlayer_with_vite+preact.md +8 -27
- package/en/intlayer_with_vite+react.md +7 -17
- package/en/intlayer_with_vite+solid.md +6 -3
- package/en/intlayer_with_vite+svelte.md +6 -3
- package/en/intlayer_with_vite+vue.md +17 -6
- package/en/packages/nuxt-intlayer/index.md +31 -0
- package/en/roadmap.md +13 -13
- package/en/t.md +5 -5
- package/en-GB/how_works_intlayer.md +16 -4
- package/en-GB/intlayer_with_create_react_app.md +1 -14
- package/en-GB/intlayer_with_nextjs_14.md +1 -14
- package/en-GB/intlayer_with_nextjs_15.md +1 -14
- package/en-GB/intlayer_with_nextjs_page_router.md +1 -13
- package/en-GB/intlayer_with_nuxt.md +795 -0
- package/en-GB/intlayer_with_react_native+expo.md +6 -3
- package/en-GB/intlayer_with_vite+preact.md +7 -18
- package/en-GB/intlayer_with_vite+react.md +6 -9
- package/en-GB/intlayer_with_vite+vue.md +65 -59
- package/en-GB/packages/nuxt-intlayer/index.md +31 -0
- package/en-GB/roadmap.md +11 -11
- package/es/autoFill.md +1 -2
- package/es/how_works_intlayer.md +1 -1
- package/es/intlayer_with_create_react_app.md +1 -14
- package/es/intlayer_with_nextjs_14.md +1 -14
- package/es/intlayer_with_nextjs_15.md +1 -14
- package/es/intlayer_with_nextjs_page_router.md +1 -13
- package/es/intlayer_with_nuxt.md +731 -0
- package/es/intlayer_with_react_native+expo.md +6 -3
- package/es/intlayer_with_vite+preact.md +7 -18
- package/es/intlayer_with_vite+react.md +7 -17
- package/es/intlayer_with_vite+vue.md +64 -51
- package/es/packages/nuxt-intlayer/index.md +29 -0
- package/fr/autoFill.md +1 -2
- package/fr/how_works_intlayer.md +1 -1
- package/fr/intlayer_with_create_react_app.md +1 -14
- package/fr/intlayer_with_nextjs_14.md +1 -14
- package/fr/intlayer_with_nextjs_15.md +1 -14
- package/fr/intlayer_with_nextjs_page_router.md +1 -13
- package/fr/intlayer_with_nuxt.md +731 -0
- package/fr/intlayer_with_react_native+expo.md +6 -3
- package/fr/intlayer_with_vite+preact.md +7 -18
- package/fr/intlayer_with_vite+react.md +7 -17
- package/fr/intlayer_with_vite+vue.md +30 -15
- package/fr/packages/nuxt-intlayer/index.md +29 -0
- package/fr/roadmap.md +11 -11
- package/hi/autoFill.md +1 -2
- package/hi/how_works_intlayer.md +1 -1
- package/hi/intlayer_with_create_react_app.md +1 -14
- package/hi/intlayer_with_nextjs_14.md +1 -14
- package/hi/intlayer_with_nextjs_15.md +1 -14
- package/hi/intlayer_with_nextjs_page_router.md +1 -13
- package/hi/intlayer_with_nuxt.md +784 -0
- package/hi/intlayer_with_react_native+expo.md +6 -3
- package/hi/intlayer_with_vite+preact.md +7 -18
- package/hi/intlayer_with_vite+react.md +7 -17
- package/hi/intlayer_with_vite+vue.md +59 -47
- package/hi/packages/nuxt-intlayer/index.md +29 -0
- package/hi/roadmap.md +11 -11
- package/index.cjs +30 -0
- package/index.d.ts +2 -0
- package/it/autoFill.md +1 -2
- package/it/how_works_intlayer.md +1 -1
- package/it/intlayer_with_create_react_app.md +0 -6
- package/it/intlayer_with_nextjs_14.md +1 -14
- package/it/intlayer_with_nextjs_15.md +1 -14
- package/it/intlayer_with_nextjs_page_router.md +1 -13
- package/it/intlayer_with_nuxt.md +793 -0
- package/it/intlayer_with_react_native+expo.md +6 -3
- package/it/intlayer_with_vite+preact.md +7 -18
- package/it/intlayer_with_vite+react.md +7 -17
- package/it/intlayer_with_vite+vue.md +26 -17
- package/it/packages/nuxt-intlayer/index.md +29 -0
- package/it/roadmap.md +11 -11
- package/ja/autoFill.md +1 -2
- package/ja/how_works_intlayer.md +1 -1
- package/ja/intlayer_with_create_react_app.md +1 -14
- package/ja/intlayer_with_nextjs_14.md +1 -14
- package/ja/intlayer_with_nextjs_15.md +1 -14
- package/ja/intlayer_with_nextjs_page_router.md +1 -13
- package/ja/intlayer_with_nuxt.md +792 -0
- package/ja/intlayer_with_react_native+expo.md +6 -3
- package/ja/intlayer_with_vite+preact.md +7 -18
- package/ja/intlayer_with_vite+react.md +7 -17
- package/ja/intlayer_with_vite+vue.md +68 -63
- package/ja/packages/nuxt-intlayer/index.md +29 -0
- package/ja/roadmap.md +11 -11
- package/ko/autoFill.md +1 -2
- package/ko/how_works_intlayer.md +1 -1
- package/ko/intlayer_with_create_react_app.md +1 -14
- package/ko/intlayer_with_nextjs_14.md +1 -14
- package/ko/intlayer_with_nextjs_15.md +1 -14
- package/ko/intlayer_with_nextjs_page_router.md +1 -13
- package/ko/intlayer_with_nuxt.md +784 -0
- package/ko/intlayer_with_react_native+expo.md +6 -3
- package/ko/intlayer_with_vite+preact.md +7 -18
- package/ko/intlayer_with_vite+react.md +7 -17
- package/ko/intlayer_with_vite+vue.md +69 -59
- package/ko/packages/nuxt-intlayer/index.md +31 -0
- package/ko/roadmap.md +11 -11
- package/package.json +5 -5
- package/pt/autoFill.md +1 -2
- package/pt/how_works_intlayer.md +1 -1
- package/pt/intlayer_with_create_react_app.md +1 -14
- package/pt/intlayer_with_nextjs_14.md +1 -14
- package/pt/intlayer_with_nextjs_15.md +1 -14
- package/pt/intlayer_with_nextjs_page_router.md +1 -13
- package/pt/intlayer_with_nuxt.md +792 -0
- package/pt/intlayer_with_react_native+expo.md +6 -3
- package/pt/intlayer_with_vite+preact.md +7 -18
- package/pt/intlayer_with_vite+react.md +7 -17
- package/pt/intlayer_with_vite+vue.md +23 -19
- package/pt/packages/nuxt-intlayer/index.md +29 -0
- package/pt/roadmap.md +11 -11
- package/ru/autoFill.md +1 -2
- package/ru/how_works_intlayer.md +1 -1
- package/ru/intlayer_with_create_react_app.md +1 -14
- package/ru/intlayer_with_nextjs_14.md +1 -14
- package/ru/intlayer_with_nextjs_15.md +1 -14
- package/ru/intlayer_with_nextjs_page_router.md +1 -13
- package/ru/intlayer_with_nuxt.md +792 -0
- package/ru/intlayer_with_react_native+expo.md +6 -3
- package/ru/intlayer_with_vite+preact.md +7 -18
- package/ru/intlayer_with_vite+react.md +7 -17
- package/ru/intlayer_with_vite+vue.md +25 -17
- package/ru/packages/nuxt-intlayer/index.md +31 -0
- package/ru/roadmap.md +11 -11
- package/zh/autoFill.md +1 -2
- package/zh/intlayer_with_create_react_app.md +1 -14
- package/zh/intlayer_with_nextjs_14.md +1 -14
- package/zh/intlayer_with_nextjs_15.md +1 -14
- package/zh/intlayer_with_nextjs_page_router.md +1 -13
- package/zh/intlayer_with_nuxt.md +784 -0
- package/zh/intlayer_with_react_native+expo.md +6 -3
- package/zh/intlayer_with_vite+preact.md +7 -18
- package/zh/intlayer_with_vite+react.md +7 -17
- package/zh/intlayer_with_vite+vue.md +68 -57
- package/zh/packages/nuxt-intlayer/index.md +31 -0
- package/zh/roadmap.md +11 -11
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
# Getting Started Internationalising (i18n) with Intlayer and Nuxt
|
|
2
|
+
|
|
3
|
+
See [Application Template](https://github.com/aymericzip/intlayer-nuxt-template) on GitHub.
|
|
4
|
+
|
|
5
|
+
## What is Intlayer?
|
|
6
|
+
|
|
7
|
+
**Intlayer** is an innovative, open-source internationalisation (i18n) library designed to simplify multilingual support in modern web applications.
|
|
8
|
+
|
|
9
|
+
With Intlayer, you can:
|
|
10
|
+
|
|
11
|
+
- **Easily manage translations** using declarative dictionaries at the component level.
|
|
12
|
+
- **Dynamically localise metadata**, routes, and content.
|
|
13
|
+
- **Ensure TypeScript support** with autogenerated types, improving autocompletion and error detection.
|
|
14
|
+
- **Benefit from advanced features**, like dynamic locale detection and switching.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Step-by-Step Guide to Set Up Intlayer in a Nuxt Application
|
|
19
|
+
|
|
20
|
+
### Step 1: Install Dependencies
|
|
21
|
+
|
|
22
|
+
Install the necessary packages using npm:
|
|
23
|
+
|
|
24
|
+
```bash packageManager="npm"
|
|
25
|
+
npm install intlayer vue-intlayer
|
|
26
|
+
npm install --save-dev nuxt-intlayer
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash packageManager="pnpm"
|
|
30
|
+
pnpm add intlayer vue-intlayer
|
|
31
|
+
pnpm add --save-dev nuxt-intlayer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash packageManager="yarn"
|
|
35
|
+
yarn add intlayer vue-intlayer
|
|
36
|
+
yarn add --save-dev nuxt-intlayer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **intlayer**
|
|
40
|
+
|
|
41
|
+
The core package that provides internationalisation tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/dictionary/get_started.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_cli.md).
|
|
42
|
+
|
|
43
|
+
- **vue-intlayer**
|
|
44
|
+
The package that integrates Intlayer with Vue application. It provides the composables for the Vue components.
|
|
45
|
+
|
|
46
|
+
- **nuxt-intlayer**
|
|
47
|
+
The Nuxt module that integrates Intlayer with Nuxt applications. It provides automatic setup, middleware for locale detection, cookie management, and URL redirection.
|
|
48
|
+
|
|
49
|
+
### Step 2: Configuration of your project
|
|
50
|
+
|
|
51
|
+
Create a config file to configure the languages of your application:
|
|
52
|
+
|
|
53
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
54
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
55
|
+
|
|
56
|
+
const config: IntlayerConfig = {
|
|
57
|
+
internationalisation: {
|
|
58
|
+
locales: [
|
|
59
|
+
Locales.ENGLISH,
|
|
60
|
+
Locales.FRENCH,
|
|
61
|
+
Locales.SPANISH,
|
|
62
|
+
// Your other locales
|
|
63
|
+
],
|
|
64
|
+
defaultLocale: Locales.ENGLISH,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default config;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
72
|
+
import { Locales } from "intlayer";
|
|
73
|
+
|
|
74
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
75
|
+
const config = {
|
|
76
|
+
internationalisation: {
|
|
77
|
+
locales: [
|
|
78
|
+
Locales.ENGLISH,
|
|
79
|
+
Locales.FRENCH,
|
|
80
|
+
Locales.SPANISH,
|
|
81
|
+
// Your other locales
|
|
82
|
+
],
|
|
83
|
+
defaultLocale: Locales.ENGLISH,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default config;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
91
|
+
const { Locales } = require("intlayer");
|
|
92
|
+
|
|
93
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
94
|
+
const config = {
|
|
95
|
+
internationalisation: {
|
|
96
|
+
locales: [
|
|
97
|
+
Locales.ENGLISH,
|
|
98
|
+
Locales.FRENCH,
|
|
99
|
+
Locales.SPANISH,
|
|
100
|
+
// Your other locales
|
|
101
|
+
],
|
|
102
|
+
defaultLocale: Locales.ENGLISH,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
module.exports = config;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> Through this configuration file, you can set up localised URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/configuration.md).
|
|
110
|
+
|
|
111
|
+
### Step 3: Integrate Intlayer in Your Nuxt Configuration
|
|
112
|
+
|
|
113
|
+
Add the intlayer module to your Nuxt configuration:
|
|
114
|
+
|
|
115
|
+
```typescript fileName="nuxt.config.ts"
|
|
116
|
+
import { defineNuxtConfig } from "nuxt/config";
|
|
117
|
+
|
|
118
|
+
export default defineNuxtConfig({
|
|
119
|
+
// ... Your existing Nuxt configuration
|
|
120
|
+
modules: ["nuxt-intlayer"],
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
> The `nuxt-intlayer` module automatically handles the integration of Intlayer with Nuxt. It sets up the content declaration building, monitors files in development mode, provides middleware for locale detection, and manages localised routing.
|
|
125
|
+
|
|
126
|
+
### Step 4: Declare Your Content
|
|
127
|
+
|
|
128
|
+
Create and manage your content declarations to store translations:
|
|
129
|
+
|
|
130
|
+
```tsx fileName="components/helloWorld.content.ts" contentDeclarationFormat="typescript"
|
|
131
|
+
import { t, type Dictionary } from "intlayer";
|
|
132
|
+
|
|
133
|
+
const helloWorldContent = {
|
|
134
|
+
key: "helloworld",
|
|
135
|
+
content: {
|
|
136
|
+
count: t({
|
|
137
|
+
"en-GB": "count is ",
|
|
138
|
+
en: "count is ",
|
|
139
|
+
fr: "le compte est ",
|
|
140
|
+
es: "el recuento es ",
|
|
141
|
+
}),
|
|
142
|
+
edit: t({
|
|
143
|
+
"en-GB":
|
|
144
|
+
"Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
145
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
146
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
147
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
148
|
+
}),
|
|
149
|
+
checkOut: t({
|
|
150
|
+
"en-GB": "Check out ",
|
|
151
|
+
en: "Check out ",
|
|
152
|
+
fr: "Vérifiez ",
|
|
153
|
+
es: "Compruebe ",
|
|
154
|
+
}),
|
|
155
|
+
nuxtIntlayer: t({
|
|
156
|
+
"en-GB": "Nuxt Intlayer documentation",
|
|
157
|
+
en: "Nuxt Intlayer documentation",
|
|
158
|
+
fr: "Documentation de Nuxt Intlayer",
|
|
159
|
+
es: "Documentación de Nuxt Intlayer",
|
|
160
|
+
}),
|
|
161
|
+
learnMore: t({
|
|
162
|
+
"en-GB": "Learn more about Nuxt in the ",
|
|
163
|
+
en: "Learn more about Nuxt in the ",
|
|
164
|
+
fr: "En savoir plus sur Nuxt dans la ",
|
|
165
|
+
es: "Aprenda más sobre Nuxt en la ",
|
|
166
|
+
}),
|
|
167
|
+
nuxtDocs: t({
|
|
168
|
+
"en-GB": "Nuxt Documentation",
|
|
169
|
+
en: "Nuxt Documentation",
|
|
170
|
+
fr: "Documentation Nuxt",
|
|
171
|
+
es: "Documentación de Nuxt",
|
|
172
|
+
}),
|
|
173
|
+
readTheDocs: t({
|
|
174
|
+
"en-GB": "Click on the Nuxt logo to learn more",
|
|
175
|
+
en: "Click on the Nuxt logo to learn more",
|
|
176
|
+
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
177
|
+
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
178
|
+
}),
|
|
179
|
+
},
|
|
180
|
+
} satisfies Dictionary;
|
|
181
|
+
|
|
182
|
+
export default helloWorldContent;
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```javascript fileName="components/helloWorld.content.mjs" contentDeclarationFormat="esm"
|
|
186
|
+
import { t } from "intlayer";
|
|
187
|
+
|
|
188
|
+
/** @type {import('intlayer').Dictionary} */
|
|
189
|
+
const helloWorldContent = {
|
|
190
|
+
key: "helloworld",
|
|
191
|
+
content: {
|
|
192
|
+
count: t({
|
|
193
|
+
"en-GB": "count is ",
|
|
194
|
+
en: "count is ",
|
|
195
|
+
fr: "le compte est ",
|
|
196
|
+
es: "el recuento es ",
|
|
197
|
+
}),
|
|
198
|
+
edit: t({
|
|
199
|
+
"en-GB":
|
|
200
|
+
"Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
201
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
202
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
203
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
204
|
+
}),
|
|
205
|
+
checkOut: t({
|
|
206
|
+
"en-GB": "Check out ",
|
|
207
|
+
en: "Check out ",
|
|
208
|
+
fr: "Vérifiez ",
|
|
209
|
+
es: "Compruebe ",
|
|
210
|
+
}),
|
|
211
|
+
nuxtIntlayer: t({
|
|
212
|
+
"en-GB": "Nuxt Intlayer documentation",
|
|
213
|
+
en: "Nuxt Intlayer documentation",
|
|
214
|
+
fr: "Documentation de Nuxt Intlayer",
|
|
215
|
+
es: "Documentación de Nuxt Intlayer",
|
|
216
|
+
}),
|
|
217
|
+
learnMore: t({
|
|
218
|
+
"en-GB": "Learn more about Nuxt in the ",
|
|
219
|
+
en: "Learn more about Nuxt in the ",
|
|
220
|
+
fr: "En savoir plus sur Nuxt dans la ",
|
|
221
|
+
es: "Aprenda más sobre Nuxt en la ",
|
|
222
|
+
}),
|
|
223
|
+
nuxtDocs: t({
|
|
224
|
+
"en-GB": "Nuxt Documentation",
|
|
225
|
+
en: "Nuxt Documentation",
|
|
226
|
+
fr: "Documentation Nuxt",
|
|
227
|
+
es: "Documentación de Nuxt",
|
|
228
|
+
}),
|
|
229
|
+
readTheDocs: t({
|
|
230
|
+
"en-GB": "Click on the Nuxt logo to learn more",
|
|
231
|
+
en: "Click on the Nuxt logo to learn more",
|
|
232
|
+
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
233
|
+
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
234
|
+
}),
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export default helloWorldContent;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```javascript fileName="components/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
|
|
242
|
+
const { t } = require("intlayer");
|
|
243
|
+
|
|
244
|
+
/** @type {import('intlayer').Dictionary} */
|
|
245
|
+
const helloWorldContent = {
|
|
246
|
+
key: "helloworld",
|
|
247
|
+
content: {
|
|
248
|
+
count: t({
|
|
249
|
+
"en-GB": "count is ",
|
|
250
|
+
en: "count is ",
|
|
251
|
+
fr: "le compte est ",
|
|
252
|
+
es: "el recuento es ",
|
|
253
|
+
}),
|
|
254
|
+
edit: t({
|
|
255
|
+
"en-GB":
|
|
256
|
+
"Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
257
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
258
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
259
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
260
|
+
}),
|
|
261
|
+
checkOut: t({
|
|
262
|
+
"en-GB": "Check out ",
|
|
263
|
+
en: "Check out ",
|
|
264
|
+
fr: "Vérifiez ",
|
|
265
|
+
es: "Compruebe ",
|
|
266
|
+
}),
|
|
267
|
+
nuxtIntlayer: t({
|
|
268
|
+
"en-GB": "Nuxt Intlayer documentation",
|
|
269
|
+
en: "Nuxt Intlayer documentation",
|
|
270
|
+
fr: "Documentation de Nuxt Intlayer",
|
|
271
|
+
es: "Documentación de Nuxt Intlayer",
|
|
272
|
+
}),
|
|
273
|
+
learnMore: t({
|
|
274
|
+
"en-GB": "Learn more about Nuxt in the ",
|
|
275
|
+
en: "Learn more about Nuxt in the ",
|
|
276
|
+
fr: "En savoir plus sur Nuxt dans la ",
|
|
277
|
+
es: "Aprenda más sobre Nuxt en la ",
|
|
278
|
+
}),
|
|
279
|
+
nuxtDocs: t({
|
|
280
|
+
"en-GB": "Nuxt Documentation",
|
|
281
|
+
en: "Nuxt Documentation",
|
|
282
|
+
fr: "Documentation Nuxt",
|
|
283
|
+
es: "Documentación de Nuxt",
|
|
284
|
+
}),
|
|
285
|
+
readTheDocs: t({
|
|
286
|
+
"en-GB": "Click on the Nuxt logo to learn more",
|
|
287
|
+
en: "Click on the Nuxt logo to learn more",
|
|
288
|
+
fr: "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
289
|
+
es: "Haga clic en el logotipo de Nuxt para obtener más información",
|
|
290
|
+
}),
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
module.exports = helloWorldContent;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
```json fileName="components/helloWorld.content.json" contentDeclarationFormat="json"
|
|
298
|
+
{
|
|
299
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
300
|
+
"key": "helloworld",
|
|
301
|
+
"content": {
|
|
302
|
+
"count": {
|
|
303
|
+
"nodeType": "translation",
|
|
304
|
+
"translation": {
|
|
305
|
+
"en-GB": "count is ",
|
|
306
|
+
"en": "count is ",
|
|
307
|
+
"fr": "le compte est ",
|
|
308
|
+
"es": "el recuento es "
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"edit": {
|
|
312
|
+
"nodeType": "translation",
|
|
313
|
+
"translation": {
|
|
314
|
+
"en-GB": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
315
|
+
"en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
316
|
+
"fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
317
|
+
"es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"checkOut": {
|
|
321
|
+
"nodeType": "translation",
|
|
322
|
+
"translation": {
|
|
323
|
+
"en-GB": "Check out ",
|
|
324
|
+
"en": "Check out ",
|
|
325
|
+
"fr": "Vérifiez ",
|
|
326
|
+
"es": "Compruebe "
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"nuxtIntlayer": {
|
|
330
|
+
"nodeType": "translation",
|
|
331
|
+
"translation": {
|
|
332
|
+
"en-GB": "Nuxt Intlayer documentation",
|
|
333
|
+
"en": "Nuxt Intlayer documentation",
|
|
334
|
+
"fr": "Documentation de Nuxt Intlayer",
|
|
335
|
+
"es": "Documentación de Nuxt Intlayer"
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"learnMore": {
|
|
339
|
+
"nodeType": "translation",
|
|
340
|
+
"translation": {
|
|
341
|
+
"en-GB": "Learn more about Nuxt in the ",
|
|
342
|
+
"en": "Learn more about Nuxt in the ",
|
|
343
|
+
"fr": "En savoir plus sur Nuxt dans la ",
|
|
344
|
+
"es": "Aprenda más sobre Nuxt en la "
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"nuxtDocs": {
|
|
348
|
+
"nodeType": "translation",
|
|
349
|
+
"translation": {
|
|
350
|
+
"en-GB": "Nuxt Documentation",
|
|
351
|
+
"en": "Nuxt Documentation",
|
|
352
|
+
"fr": "Documentation Nuxt",
|
|
353
|
+
"es": "Documentación de Nuxt"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"readTheDocs": {
|
|
357
|
+
"nodeType": "translation",
|
|
358
|
+
"translation": {
|
|
359
|
+
"en-GB": "Click on the Nuxt logo to learn more",
|
|
360
|
+
"en": "Click on the Nuxt logo to learn more",
|
|
361
|
+
"fr": "Cliquez sur le logo Nuxt pour en savoir plus",
|
|
362
|
+
"es": "Haga clic en el logotipo de Nuxt para obtener más información"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
> Your content declarations can be defined anywhere in your application as long as they are included in the `contentDir` directory (by default, `./src`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
370
|
+
|
|
371
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/dictionary/get_started.md).
|
|
372
|
+
|
|
373
|
+
### Step 5: Utilise Intlayer in Your Code
|
|
374
|
+
|
|
375
|
+
Access your content dictionaries throughout your Nuxt application using the `useIntlayer` composable:
|
|
376
|
+
|
|
377
|
+
```vue fileName="components/HelloWorld.vue"
|
|
378
|
+
<script setup lang="ts">
|
|
379
|
+
import { ref } from "vue";
|
|
380
|
+
import { useIntlayer } from "vue-intlayer";
|
|
381
|
+
|
|
382
|
+
defineProps({
|
|
383
|
+
msg: String,
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
const {
|
|
387
|
+
count,
|
|
388
|
+
edit,
|
|
389
|
+
checkOut,
|
|
390
|
+
nuxtIntlayer,
|
|
391
|
+
learnMore,
|
|
392
|
+
nuxtDocs,
|
|
393
|
+
readTheDocs,
|
|
394
|
+
} = useIntlayer("helloworld");
|
|
395
|
+
const countRef = ref(0);
|
|
396
|
+
</script>
|
|
397
|
+
|
|
398
|
+
<template>
|
|
399
|
+
<h1>{{ msg }}</h1>
|
|
400
|
+
|
|
401
|
+
<div class="card">
|
|
402
|
+
<button type="button" @click="countRef++">
|
|
403
|
+
<count />
|
|
404
|
+
{{ countRef }}
|
|
405
|
+
</button>
|
|
406
|
+
<p v-html="edit"></p>
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
<p>
|
|
410
|
+
<checkOut />
|
|
411
|
+
<a href="https://nuxt.com/docs/getting-started/introduction" target="_blank"
|
|
412
|
+
>Nuxt</a
|
|
413
|
+
>, <nuxtIntlayer />
|
|
414
|
+
</p>
|
|
415
|
+
<p>
|
|
416
|
+
<learnMore />
|
|
417
|
+
<a href="https://nuxt.com" target="_blank"><nuxtDocs /></a>.
|
|
418
|
+
</p>
|
|
419
|
+
<p class="read-the-docs"><readTheDocs /></p>
|
|
420
|
+
<p class="read-the-docs">{{ readTheDocs }}</p>
|
|
421
|
+
</template>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
#### Accessing Content in Intlayer
|
|
425
|
+
|
|
426
|
+
Intlayer offers two APIs to access your content:
|
|
427
|
+
|
|
428
|
+
- **Component-based syntax** (recommended):
|
|
429
|
+
Use the `<myContent />`, or `<Component :is="myContent" />` syntax to render content as an Intlayer Node. This integrates seamlessly with the [Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_visual_editor.md) and [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_CMS.md).
|
|
430
|
+
|
|
431
|
+
- **String-based syntax**:
|
|
432
|
+
Use `{{ myContent }}` to render the content as plain text, without Visual Editor support.
|
|
433
|
+
|
|
434
|
+
- **Raw HTML syntax**:
|
|
435
|
+
Use `<div v-html="myContent" />` to render the content as raw HTML, without Visual Editor support.
|
|
436
|
+
|
|
437
|
+
- **Destructuration syntax**:
|
|
438
|
+
The `useIntlayer` composable returns an Proxy with the content. This proxy can be destructured to access the content while keeping the reactivity.
|
|
439
|
+
- Use `const content = useIntlayer("myContent");` And `{{ content.myContent }}` / `<content.myContent />`.
|
|
440
|
+
- Or use `const { myContent } = useIntlayer("myContent");` And `{{ myContent}}` / `<myContent/>` to destructure the content.
|
|
441
|
+
|
|
442
|
+
### (Optional) Step 6: Change the language of your content
|
|
443
|
+
|
|
444
|
+
To change the language of your content, you can use the `setLocale` function provided by the `useLocale` composable. This function allows you to set the locale of the application and update the content accordingly.
|
|
445
|
+
|
|
446
|
+
Create a component to switch between languages:
|
|
447
|
+
|
|
448
|
+
```vue fileName="components/LocaleSwitcher.vue"
|
|
449
|
+
<template>
|
|
450
|
+
<div class="locale-switcher">
|
|
451
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
452
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
453
|
+
{{ getLocaleName(loc) }}
|
|
454
|
+
</option>
|
|
455
|
+
</select>
|
|
456
|
+
</div>
|
|
457
|
+
</template>
|
|
458
|
+
|
|
459
|
+
<script setup lang="ts">
|
|
460
|
+
import { ref, watch } from "vue";
|
|
461
|
+
import { getLocaleName } from "intlayer";
|
|
462
|
+
import { useLocale } from "vue-intlayer";
|
|
463
|
+
|
|
464
|
+
// Get locale information and setLocale function
|
|
465
|
+
const { locale, availableLocales, setLocale } = useLocale();
|
|
466
|
+
|
|
467
|
+
// Track the selected locale with a ref
|
|
468
|
+
const selectedLocale = ref(locale.value);
|
|
469
|
+
|
|
470
|
+
// Update the locale when the selection changes
|
|
471
|
+
const changeLocale = () => setLocale(selectedLocale.value);
|
|
472
|
+
|
|
473
|
+
// Keep the selectedLocale in sync with the global locale
|
|
474
|
+
watch(
|
|
475
|
+
() => locale.value,
|
|
476
|
+
(newLocale) => {
|
|
477
|
+
selectedLocale.value = newLocale;
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
</script>
|
|
481
|
+
</template>
|
|
482
|
+
|
|
483
|
+
<style scoped>
|
|
484
|
+
.locale-switcher {
|
|
485
|
+
margin: 1rem 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
select {
|
|
489
|
+
padding: 0.5rem;
|
|
490
|
+
border-radius: 0.25rem;
|
|
491
|
+
border: 1px solid #ccc;
|
|
492
|
+
}
|
|
493
|
+
</style>
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Then, use this component in your pages or layout:
|
|
497
|
+
|
|
498
|
+
```vue fileName="app.vue"
|
|
499
|
+
<script setup lang="ts">
|
|
500
|
+
import { useIntlayer } from "vue-intlayer";
|
|
501
|
+
import LocaleSwitcher from "~/components/LocaleSwitcher.vue";
|
|
502
|
+
|
|
503
|
+
const content = useIntlayer("app"); // Create related intlayer declaration file
|
|
504
|
+
</script>
|
|
505
|
+
|
|
506
|
+
<template>
|
|
507
|
+
<div>
|
|
508
|
+
<header>
|
|
509
|
+
<LocaleSwitcher />
|
|
510
|
+
</header>
|
|
511
|
+
<main>
|
|
512
|
+
<NuxtPage />
|
|
513
|
+
</main>
|
|
514
|
+
</div>
|
|
515
|
+
</template>
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### (Optional) Step 7: Add localised Routing to your application
|
|
519
|
+
|
|
520
|
+
Nuxt automatically handles localised routing when using the `nuxt-intlayer` module. This creates routes for each language automatically based on your pages directory structure.
|
|
521
|
+
|
|
522
|
+
Example:
|
|
523
|
+
|
|
524
|
+
```plaintext
|
|
525
|
+
pages/
|
|
526
|
+
├── index.vue → /, /fr, /es
|
|
527
|
+
├── about.vue → /about, /fr/about, /es/about
|
|
528
|
+
└── contact/
|
|
529
|
+
└── index.vue → /contact, /fr/contact, /es/contact
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
To create a localised page, simply create your Vue files in the `pages/` directory:
|
|
533
|
+
|
|
534
|
+
```vue fileName="pages/about.vue"
|
|
535
|
+
<script setup lang="ts">
|
|
536
|
+
import { useIntlayer } from "vue-intlayer";
|
|
537
|
+
|
|
538
|
+
const content = useIntlayer("about");
|
|
539
|
+
</script>
|
|
540
|
+
|
|
541
|
+
<template>
|
|
542
|
+
<div>
|
|
543
|
+
<h1>{{ content.title }}</h1>
|
|
544
|
+
<p>{{ content.description }}</p>
|
|
545
|
+
</div>
|
|
546
|
+
</template>
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
The `nuxt-intlayer` module will automatically:
|
|
550
|
+
|
|
551
|
+
- Detect the user's preferred locale
|
|
552
|
+
- Handle locale switching via URL
|
|
553
|
+
- Set the appropriate `<html lang="">` attribute
|
|
554
|
+
- Manage locale cookies
|
|
555
|
+
- Redirect users to the appropriate localised URL
|
|
556
|
+
|
|
557
|
+
### (Optional) Step 8: Creating a Localised Link Component
|
|
558
|
+
|
|
559
|
+
To ensure that your application's navigation respects the current locale, you can create a custom `LocalisedLink` component. This component automatically prefixes internal URLs with the current language.
|
|
560
|
+
|
|
561
|
+
```vue fileName="components/LocalisedLink.vue"
|
|
562
|
+
<template>
|
|
563
|
+
<NuxtLink :to="localisedHref" v-bind="$attrs">
|
|
564
|
+
<slot />
|
|
565
|
+
</NuxtLink>
|
|
566
|
+
</template>
|
|
567
|
+
|
|
568
|
+
<script setup lang="ts">
|
|
569
|
+
import { computed } from "vue";
|
|
570
|
+
import { getLocalisedUrl } from "intlayer";
|
|
571
|
+
import { useLocale } from "vue-intlayer";
|
|
572
|
+
|
|
573
|
+
const props = defineProps({
|
|
574
|
+
to: {
|
|
575
|
+
type: String,
|
|
576
|
+
required: true,
|
|
577
|
+
},
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
const { locale } = useLocale();
|
|
581
|
+
|
|
582
|
+
// Check if the link is external
|
|
583
|
+
const isExternalLink = computed(() => /^https?:\/\//.test(props.to || ""));
|
|
584
|
+
|
|
585
|
+
// Create a localised href for internal links
|
|
586
|
+
const localisedHref = computed(() =>
|
|
587
|
+
isExternalLink.value ? props.to : getLocalisedUrl(props.to, locale.value)
|
|
588
|
+
);
|
|
589
|
+
</script>
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
Then use this component throughout your application:
|
|
593
|
+
|
|
594
|
+
```vue fileName="pages/index.vue"
|
|
595
|
+
<template>
|
|
596
|
+
<div>
|
|
597
|
+
<LocalisedLink to="/about">
|
|
598
|
+
{{ content.aboutLink }}
|
|
599
|
+
</LocalisedLink>
|
|
600
|
+
|
|
601
|
+
<LocalizedLink to="/en-GB/contact">
|
|
602
|
+
{{ content.contactLink }}
|
|
603
|
+
</LocalizedLink>
|
|
604
|
+
</div>
|
|
605
|
+
</template>
|
|
606
|
+
|
|
607
|
+
<script setup lang="ts">
|
|
608
|
+
import { useIntlayer } from "vue-intlayer";
|
|
609
|
+
import LocalizedLink from "~/components/LocalizedLink.vue";
|
|
610
|
+
|
|
611
|
+
const content = useIntlayer("home");
|
|
612
|
+
</script>
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### (Optional) Step 9: Handle Metadata and SEO
|
|
616
|
+
|
|
617
|
+
Nuxt provides excellent SEO capabilities. You can use Intlayer to handle localised metadata:
|
|
618
|
+
|
|
619
|
+
```vue fileName="pages/about.vue"
|
|
620
|
+
<script setup lang="ts">
|
|
621
|
+
import { useSeoMeta } from "nuxt/app";
|
|
622
|
+
import { getIntlayer } from "intlayer";
|
|
623
|
+
import { useLocale } from "vue-intlayer";
|
|
624
|
+
|
|
625
|
+
const { locale } = useLocale();
|
|
626
|
+
const content = getIntlayer("about-meta", locale.value);
|
|
627
|
+
|
|
628
|
+
useSeoMeta({
|
|
629
|
+
title: content.title,
|
|
630
|
+
description: content.description,
|
|
631
|
+
});
|
|
632
|
+
</script>
|
|
633
|
+
|
|
634
|
+
<template>
|
|
635
|
+
<div>
|
|
636
|
+
<h1>{{ content.pageTitle }}</h1>
|
|
637
|
+
<p>{{ content.pageContent }}</p>
|
|
638
|
+
</div>
|
|
639
|
+
</template>
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
Create the corresponding content declaration:
|
|
643
|
+
|
|
644
|
+
```typescript fileName="pages/about-meta.content.ts" contentDeclarationFormat="typescript"
|
|
645
|
+
import { t, type Dictionary } from "intlayer";
|
|
646
|
+
import type { useSeoMeta } from "nuxt/app";
|
|
647
|
+
|
|
648
|
+
const aboutMetaContent = {
|
|
649
|
+
key: "about-meta",
|
|
650
|
+
content: {
|
|
651
|
+
title: t({
|
|
652
|
+
"en-GB": "About Us - My Company",
|
|
653
|
+
en: "About Us - My Company",
|
|
654
|
+
fr: "À Propos - Ma Société",
|
|
655
|
+
es: "Acerca de Nosotros - Mi Empresa",
|
|
656
|
+
}),
|
|
657
|
+
description: t({
|
|
658
|
+
"en-GB": "Learn more about our company and our mission",
|
|
659
|
+
en: "Learn more about our company and our mission",
|
|
660
|
+
fr: "En savoir plus sur notre société et notre mission",
|
|
661
|
+
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
662
|
+
}),
|
|
663
|
+
},
|
|
664
|
+
} satisfies Dictionary<Parameters<typeof useSeoMeta>[0]>;
|
|
665
|
+
|
|
666
|
+
export default aboutMetaContent;
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
```typescript fileName="pages/about-meta.content.mjs" contentDeclarationFormat="esm"
|
|
670
|
+
import { t } from "intlayer";
|
|
671
|
+
|
|
672
|
+
/** @type {import('intlayer').Dictionary} */
|
|
673
|
+
const aboutMetaContent = {
|
|
674
|
+
key: "about-meta",
|
|
675
|
+
content: {
|
|
676
|
+
title: t({
|
|
677
|
+
"en-GB": "About Us - My Company",
|
|
678
|
+
en: "About Us - My Company",
|
|
679
|
+
fr: "À Propos - Ma Société",
|
|
680
|
+
es: "Acerca de Nosotros - Mi Empresa",
|
|
681
|
+
}),
|
|
682
|
+
description: t({
|
|
683
|
+
"en-GB": "Learn more about our company and our mission",
|
|
684
|
+
en: "Learn more about our company and our mission",
|
|
685
|
+
fr: "En savoir plus sur notre société et notre mission",
|
|
686
|
+
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
687
|
+
}),
|
|
688
|
+
},
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
export default aboutMetaContent;
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
```typescript fileName="pages/about-meta.content.js" contentDeclarationFormat="cjs"
|
|
695
|
+
const { t } = require("intlayer");
|
|
696
|
+
|
|
697
|
+
/** @type {import('intlayer').Dictionary} */
|
|
698
|
+
const aboutMetaContent = {
|
|
699
|
+
key: "about-meta",
|
|
700
|
+
content: {
|
|
701
|
+
title: t({
|
|
702
|
+
"en-GB": "About Us - My Company",
|
|
703
|
+
en: "About Us - My Company",
|
|
704
|
+
fr: "À Propos - Ma Société",
|
|
705
|
+
es: "Acerca de Nosotros - Mi Empresa",
|
|
706
|
+
}),
|
|
707
|
+
description: t({
|
|
708
|
+
"en-GB": "Learn more about our company and our mission",
|
|
709
|
+
en: "Learn more about our company and our mission",
|
|
710
|
+
fr: "En savoir plus sur notre société et notre mission",
|
|
711
|
+
es: "Conozca más sobre nuestra empresa y nuestra misión",
|
|
712
|
+
}),
|
|
713
|
+
},
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
module.exports = aboutMetaContent;
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
```json fileName="pages/about-meta.content.json" contentDeclarationFormat="json"
|
|
720
|
+
{
|
|
721
|
+
"key": "about-meta",
|
|
722
|
+
"content": {
|
|
723
|
+
"title": {
|
|
724
|
+
"nodeType": "translation",
|
|
725
|
+
"translations": {
|
|
726
|
+
"en-GB": "About Us - My Company",
|
|
727
|
+
"en": "About Us - My Company",
|
|
728
|
+
"fr": "À Propos - Ma Société",
|
|
729
|
+
"es": "Acerca de Nosotros - Mi Empresa"
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
"description": {
|
|
733
|
+
"nodeType": "translation",
|
|
734
|
+
"translations": {
|
|
735
|
+
"en-GB": "Learn more about our company and our mission",
|
|
736
|
+
"en": "Learn more about our company and our mission",
|
|
737
|
+
"fr": "En savoir plus sur notre société et notre mission",
|
|
738
|
+
"es": "Conozca más sobre nuestra empresa y nuestra misión"
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### Configure TypeScript
|
|
746
|
+
|
|
747
|
+
Intlayer uses module augmentation to get the benefits of TypeScript and make your codebase stronger.
|
|
748
|
+
|
|
749
|
+

|
|
750
|
+
|
|
751
|
+

|
|
752
|
+
|
|
753
|
+
Ensure your TypeScript configuration includes the autogenerated types.
|
|
754
|
+
|
|
755
|
+
```json5 fileName="tsconfig.json"
|
|
756
|
+
{
|
|
757
|
+
// ... Your existing TypeScript configurations
|
|
758
|
+
"include": [
|
|
759
|
+
// ... Your existing TypeScript configurations
|
|
760
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
761
|
+
],
|
|
762
|
+
}
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
### Git Configuration
|
|
766
|
+
|
|
767
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
768
|
+
|
|
769
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
770
|
+
|
|
771
|
+
```plaintext fileName=".gitignore"
|
|
772
|
+
# Ignore the files generated by Intlayer
|
|
773
|
+
.intlayer
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### VS Code Extension
|
|
777
|
+
|
|
778
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
779
|
+
|
|
780
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
781
|
+
|
|
782
|
+
This extension provides:
|
|
783
|
+
|
|
784
|
+
- **Autocompletion** for translation keys.
|
|
785
|
+
- **Real-time error detection** for missing translations.
|
|
786
|
+
- **Inline previews** of translated content.
|
|
787
|
+
- **Quick actions** to easily create and update translations.
|
|
788
|
+
|
|
789
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
### Go Further
|
|
794
|
+
|
|
795
|
+
## To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_visual_editor.md) or externalise your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_CMS.md).
|