@intlayer/docs 7.1.8-canary.0 → 7.1.8
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/docs/ar/intlayer_with_vite+svelte.md +35 -8
- package/docs/de/intlayer_with_vite+svelte.md +35 -8
- package/docs/en/intlayer_with_vite+svelte.md +153 -11
- package/docs/en-GB/intlayer_with_vite+svelte.md +35 -8
- package/docs/es/intlayer_with_vite+svelte.md +35 -8
- package/docs/fr/intlayer_with_vite+svelte.md +35 -8
- package/docs/hi/intlayer_with_vite+svelte.md +28 -7
- package/docs/id/intlayer_with_vite+svelte.md +35 -8
- package/docs/it/intlayer_with_vite+svelte.md +35 -8
- package/docs/ja/intlayer_with_vite+svelte.md +35 -8
- package/docs/ko/intlayer_with_vite+svelte.md +46 -14
- package/docs/pl/intlayer_with_vite+svelte.md +35 -8
- package/docs/pt/intlayer_with_vite+svelte.md +35 -8
- package/docs/ru/intlayer_with_vite+svelte.md +35 -8
- package/docs/tr/intlayer_with_vite+svelte.md +35 -8
- package/docs/vi/intlayer_with_vite+svelte.md +35 -8
- package/docs/zh/intlayer_with_vite+svelte.md +35 -8
- package/package.json +6 -6
|
@@ -139,23 +139,23 @@ module.exports = config;
|
|
|
139
139
|
|
|
140
140
|
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
141
141
|
import { defineConfig } from "vite";
|
|
142
|
-
import
|
|
142
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
143
143
|
import { intlayer } from "vite-intlayer";
|
|
144
144
|
|
|
145
145
|
// https://vitejs.dev/config/
|
|
146
146
|
export default defineConfig({
|
|
147
|
-
plugins: [
|
|
147
|
+
plugins: [svelte(), intlayer()],
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
152
152
|
import { defineConfig } from "vite";
|
|
153
|
-
import
|
|
153
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
154
154
|
import { intlayer } from "vite-intlayer";
|
|
155
155
|
|
|
156
156
|
// https://vitejs.dev/config/
|
|
157
157
|
export default defineConfig({
|
|
158
|
-
plugins: [
|
|
158
|
+
plugins: [svelte(), intlayer()],
|
|
159
159
|
});
|
|
160
160
|
```
|
|
161
161
|
|
|
@@ -181,7 +181,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
181
181
|
|
|
182
182
|
const appContent = {
|
|
183
183
|
key: "app",
|
|
184
|
-
content: {
|
|
184
|
+
content: {
|
|
185
|
+
title: t({
|
|
186
|
+
en: "Hello World",
|
|
187
|
+
fr: "Bonjour le monde",
|
|
188
|
+
es: "Hola mundo",
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
185
191
|
} satisfies Dictionary;
|
|
186
192
|
|
|
187
193
|
export default appContent;
|
|
@@ -193,7 +199,13 @@ import { t } from "intlayer";
|
|
|
193
199
|
/** @type {import('intlayer').Dictionary} */
|
|
194
200
|
const appContent = {
|
|
195
201
|
key: "app",
|
|
196
|
-
content: {
|
|
202
|
+
content: {
|
|
203
|
+
title: t({
|
|
204
|
+
en: "Hello World",
|
|
205
|
+
fr: "Bonjour le monde",
|
|
206
|
+
es: "Hola mundo",
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
197
209
|
};
|
|
198
210
|
|
|
199
211
|
export default appContent;
|
|
@@ -206,7 +218,13 @@ const { t } = require("intlayer");
|
|
|
206
218
|
// تعريف محتوى التطبيق
|
|
207
219
|
const appContent = {
|
|
208
220
|
key: "app",
|
|
209
|
-
content: {
|
|
221
|
+
content: {
|
|
222
|
+
title: t({
|
|
223
|
+
en: "Hello World",
|
|
224
|
+
fr: "Bonjour le monde",
|
|
225
|
+
es: "Hola mundo",
|
|
226
|
+
}),
|
|
227
|
+
},
|
|
210
228
|
};
|
|
211
229
|
|
|
212
230
|
module.exports = appContent;
|
|
@@ -216,7 +234,16 @@ module.exports = appContent;
|
|
|
216
234
|
{
|
|
217
235
|
"$schema": "https://intlayer.org/schema.json",
|
|
218
236
|
"key": "app",
|
|
219
|
-
"content": {
|
|
237
|
+
"content": {
|
|
238
|
+
"title": {
|
|
239
|
+
"nodeType": "translation",
|
|
240
|
+
"translation": {
|
|
241
|
+
"en": "Hello World",
|
|
242
|
+
"fr": "Bonjour le monde",
|
|
243
|
+
"es": "Hola mundo"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
220
247
|
}
|
|
221
248
|
```
|
|
222
249
|
|
|
@@ -142,23 +142,23 @@ Fügen Sie das Intlayer-Plugin in Ihre Konfiguration ein.
|
|
|
142
142
|
|
|
143
143
|
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
144
144
|
import { defineConfig } from "vite";
|
|
145
|
-
import
|
|
145
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
146
146
|
import { intlayer } from "vite-intlayer";
|
|
147
147
|
|
|
148
148
|
// https://vitejs.dev/config/
|
|
149
149
|
export default defineConfig({
|
|
150
|
-
plugins: [
|
|
150
|
+
plugins: [svelte(), intlayer()],
|
|
151
151
|
});
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
155
155
|
import { defineConfig } from "vite";
|
|
156
|
-
import
|
|
156
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
157
157
|
import { intlayer } from "vite-intlayer";
|
|
158
158
|
|
|
159
159
|
// https://vitejs.dev/config/
|
|
160
160
|
export default defineConfig({
|
|
161
|
-
plugins: [
|
|
161
|
+
plugins: [svelte(), intlayer()],
|
|
162
162
|
});
|
|
163
163
|
```
|
|
164
164
|
|
|
@@ -184,7 +184,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
184
184
|
|
|
185
185
|
const appContent = {
|
|
186
186
|
key: "app",
|
|
187
|
-
content: {
|
|
187
|
+
content: {
|
|
188
|
+
title: t({
|
|
189
|
+
en: "Hello World",
|
|
190
|
+
fr: "Bonjour le monde",
|
|
191
|
+
es: "Hola mundo",
|
|
192
|
+
}),
|
|
193
|
+
},
|
|
188
194
|
} satisfies Dictionary;
|
|
189
195
|
|
|
190
196
|
export default appContent;
|
|
@@ -196,7 +202,13 @@ import { t } from "intlayer";
|
|
|
196
202
|
/** @type {import('intlayer').Dictionary} */
|
|
197
203
|
const appContent = {
|
|
198
204
|
key: "app",
|
|
199
|
-
content: {
|
|
205
|
+
content: {
|
|
206
|
+
title: t({
|
|
207
|
+
en: "Hello World",
|
|
208
|
+
fr: "Bonjour le monde",
|
|
209
|
+
es: "Hola mundo",
|
|
210
|
+
}),
|
|
211
|
+
},
|
|
200
212
|
};
|
|
201
213
|
|
|
202
214
|
export default appContent;
|
|
@@ -209,7 +221,13 @@ const { t } = require("intlayer");
|
|
|
209
221
|
// Definiert den Inhalt der Anwendung
|
|
210
222
|
const appContent = {
|
|
211
223
|
key: "app",
|
|
212
|
-
content: {
|
|
224
|
+
content: {
|
|
225
|
+
title: t({
|
|
226
|
+
en: "Hello World",
|
|
227
|
+
fr: "Bonjour le monde",
|
|
228
|
+
es: "Hola mundo",
|
|
229
|
+
}),
|
|
230
|
+
},
|
|
213
231
|
};
|
|
214
232
|
|
|
215
233
|
module.exports = appContent;
|
|
@@ -219,7 +237,16 @@ module.exports = appContent;
|
|
|
219
237
|
{
|
|
220
238
|
"$schema": "https://intlayer.org/schema.json",
|
|
221
239
|
"key": "app",
|
|
222
|
-
"content": {
|
|
240
|
+
"content": {
|
|
241
|
+
"title": {
|
|
242
|
+
"nodeType": "translation",
|
|
243
|
+
"translation": {
|
|
244
|
+
"en": "Hello World",
|
|
245
|
+
"fr": "Bonjour le monde",
|
|
246
|
+
"es": "Hola mundo"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
223
250
|
}
|
|
224
251
|
```
|
|
225
252
|
|
|
@@ -16,6 +16,9 @@ slugs:
|
|
|
16
16
|
- vite-and-svelte
|
|
17
17
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-svelte-template
|
|
18
18
|
history:
|
|
19
|
+
- version: 5.5.11
|
|
20
|
+
date: 2025-11-19
|
|
21
|
+
changes: Update doc
|
|
19
22
|
- version: 5.5.10
|
|
20
23
|
date: 2025-06-29
|
|
21
24
|
changes: Init history
|
|
@@ -25,8 +28,6 @@ history:
|
|
|
25
28
|
|
|
26
29
|
> This package is in development. See the [issue](https://github.com/aymericzip/intlayer/issues/114) for more information. Show your interest in Intlayer for Svelte by liking the issue
|
|
27
30
|
|
|
28
|
-
<!-- See [Application Template](https://github.com/aymericzip/intlayer-solid-template) on GitHub. -->
|
|
29
|
-
|
|
30
31
|
## Table of Contents
|
|
31
32
|
|
|
32
33
|
<TOC/>
|
|
@@ -46,6 +47,16 @@ With Intlayer, you can:
|
|
|
46
47
|
|
|
47
48
|
## Step-by-Step Guide to Set Up Intlayer in a Vite and Svelte Application
|
|
48
49
|
|
|
50
|
+
<iframe
|
|
51
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-react-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
52
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
53
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
54
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
55
|
+
loading="lazy"
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
See [Application Template](https://github.com/aymericzip/intlayer-vite-svelte-template) on GitHub.
|
|
59
|
+
|
|
49
60
|
### Step 1: Install Dependencies
|
|
50
61
|
|
|
51
62
|
Install the necessary packages using npm:
|
|
@@ -125,7 +136,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
125
136
|
|
|
126
137
|
const appContent = {
|
|
127
138
|
key: "app",
|
|
128
|
-
content: {
|
|
139
|
+
content: {
|
|
140
|
+
title: t({
|
|
141
|
+
en: "Hello World",
|
|
142
|
+
fr: "Bonjour le monde",
|
|
143
|
+
es: "Hola mundo",
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
129
146
|
} satisfies Dictionary;
|
|
130
147
|
|
|
131
148
|
export default appContent;
|
|
@@ -137,7 +154,13 @@ import { t } from "intlayer";
|
|
|
137
154
|
/** @type {import('intlayer').Dictionary} */
|
|
138
155
|
const appContent = {
|
|
139
156
|
key: "app",
|
|
140
|
-
content: {
|
|
157
|
+
content: {
|
|
158
|
+
title: t({
|
|
159
|
+
en: "Hello World",
|
|
160
|
+
fr: "Bonjour le monde",
|
|
161
|
+
es: "Hola mundo",
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
141
164
|
};
|
|
142
165
|
|
|
143
166
|
export default appContent;
|
|
@@ -149,7 +172,13 @@ const { t } = require("intlayer");
|
|
|
149
172
|
/** @type {import('intlayer').Dictionary} */
|
|
150
173
|
const appContent = {
|
|
151
174
|
key: "app",
|
|
152
|
-
content: {
|
|
175
|
+
content: {
|
|
176
|
+
title: t({
|
|
177
|
+
en: "Hello World",
|
|
178
|
+
fr: "Bonjour le monde",
|
|
179
|
+
es: "Hola mundo",
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
153
182
|
};
|
|
154
183
|
|
|
155
184
|
module.exports = appContent;
|
|
@@ -159,7 +188,16 @@ module.exports = appContent;
|
|
|
159
188
|
{
|
|
160
189
|
"$schema": "https://intlayer.org/schema.json",
|
|
161
190
|
"key": "app",
|
|
162
|
-
"content": {
|
|
191
|
+
"content": {
|
|
192
|
+
"title": {
|
|
193
|
+
"nodeType": "translation",
|
|
194
|
+
"translation": {
|
|
195
|
+
"en": "Hello World",
|
|
196
|
+
"fr": "Bonjour le monde",
|
|
197
|
+
"es": "Hola mundo"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
163
201
|
}
|
|
164
202
|
```
|
|
165
203
|
|
|
@@ -169,16 +207,122 @@ module.exports = appContent;
|
|
|
169
207
|
|
|
170
208
|
### Step 5: Utilize Intlayer in Your Code
|
|
171
209
|
|
|
172
|
-
|
|
210
|
+
```svelte fileName="src/App.svelte"
|
|
211
|
+
<script>
|
|
212
|
+
import { useIntlayer } from "svelte-intlayer";
|
|
213
|
+
|
|
214
|
+
const content = useIntlayer("app");
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<h1>{$content.title}</h1>
|
|
218
|
+
|
|
219
|
+
```
|
|
173
220
|
|
|
174
221
|
### (Optional) Step 6: Change the language of your content
|
|
175
222
|
|
|
176
|
-
|
|
223
|
+
```svelte fileName="src/App.svelte"
|
|
224
|
+
<script lang="ts">
|
|
225
|
+
import { getLocaleName } from 'intlayer';
|
|
226
|
+
import { useLocale } from 'svelte-intlayer';
|
|
227
|
+
|
|
228
|
+
// Get locale information and setLocale function
|
|
229
|
+
const { locale, availableLocales, setLocale } = useLocale();
|
|
230
|
+
|
|
231
|
+
// Handle locale change
|
|
232
|
+
const changeLocale = (event: Event) => {
|
|
233
|
+
const target = event.target as HTMLSelectElement;
|
|
234
|
+
const newLocale = target.value;
|
|
235
|
+
setLocale(newLocale);
|
|
236
|
+
};
|
|
237
|
+
</script>
|
|
238
|
+
|
|
239
|
+
<div>
|
|
240
|
+
<select value={$locale} on:change={changeLocale}>
|
|
241
|
+
{#each availableLocales ?? [] as loc}
|
|
242
|
+
<option value={loc}>
|
|
243
|
+
{getLocaleName(loc)}
|
|
244
|
+
</option>
|
|
245
|
+
{/each}
|
|
246
|
+
</select>
|
|
247
|
+
</div>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### (Optional) Step 7: Render Markdown
|
|
251
|
+
|
|
252
|
+
Intlayer supports rendering Markdown content directly in your Svelte application. By default, Markdown is treated as plain text. To convert Markdown into rich HTML, you can integrate `@humanspeak/svelte-markdown`, or a other markdown parser.
|
|
253
|
+
|
|
254
|
+
> To see how to declare markdown content using the `intlayer` package, see the [markdown doc](https://github.com/aymericzip/intlayer/tree/main/docs/en/dictionary/markdown.md).
|
|
255
|
+
|
|
256
|
+
```svelte fileName="src/App.svelte"
|
|
257
|
+
<script>
|
|
258
|
+
import { setIntlayerMarkdown } from "svelte-intlayer";
|
|
259
|
+
|
|
260
|
+
setIntlayerMarkdown((markdown) =>
|
|
261
|
+
// render the markdown content as a string
|
|
262
|
+
return markdown;
|
|
263
|
+
);
|
|
264
|
+
</script>
|
|
265
|
+
|
|
266
|
+
<h1>{$content.markdownContent}</h1>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
> You can also access your markdown front-matter data using the `content.markdownContent.metadata.xxx` property.
|
|
270
|
+
|
|
271
|
+
### (Optional) Step 8: Set up the intlayer editor / CMS
|
|
272
|
+
|
|
273
|
+
To set up the intlayer editor, you must follow the [intlayer editor documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md).
|
|
274
|
+
|
|
275
|
+
To set up the intlayer CMS, you must follow the [intlayer CMS documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
|
|
276
|
+
|
|
277
|
+
In parallel, in your Svelte application, you must add the following line in a layout, or at the root of your application:
|
|
278
|
+
|
|
279
|
+
```svelte fileName="src/layout.svelte"
|
|
280
|
+
import { useIntlayerEditor } from "svelte-intlayer";
|
|
281
|
+
|
|
282
|
+
useIntlayerEditor();
|
|
283
|
+
```
|
|
177
284
|
|
|
178
285
|
### (Optional) Step 7: Add localized Routing to your application
|
|
179
286
|
|
|
180
287
|
[to complete]
|
|
181
288
|
|
|
289
|
+
In parallel, you can also use the `intlayerProxy` to add server-side routing to your application. This plugin will automatically detect the current locale based on the URL and set the appropriate locale cookie. If no locale is specified, the plugin will determine the most appropriate locale based on the user's browser language preferences. If no locale is detected, it will redirect to the default locale.
|
|
290
|
+
|
|
291
|
+
> Note that to use the `intlayerProxy` in production, you need to switch the `vite-intlayer` package from `devDependencies` to `dependencies`.
|
|
292
|
+
|
|
293
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
294
|
+
import { defineConfig } from "vite";
|
|
295
|
+
import react from "@vitejs/plugin-react-swc";
|
|
296
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
297
|
+
|
|
298
|
+
// https://vitejs.dev/config/
|
|
299
|
+
export default defineConfig({
|
|
300
|
+
plugins: [react(), intlayer(), intlayerProxy()],
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
305
|
+
import { defineConfig } from "vite";
|
|
306
|
+
import react from "@vitejs/plugin-react-swc";
|
|
307
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
308
|
+
|
|
309
|
+
// https://vitejs.dev/config/
|
|
310
|
+
export default defineConfig({
|
|
311
|
+
plugins: [react(), intlayer(), intlayerProxy()],
|
|
312
|
+
});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
316
|
+
const { defineConfig } = require("vite");
|
|
317
|
+
const react = require("@vitejs/plugin-react-swc");
|
|
318
|
+
const { intlayer, intlayerProxy } = require("vite-intlayer");
|
|
319
|
+
|
|
320
|
+
// https://vitejs.dev/config/
|
|
321
|
+
module.exports = defineConfig({
|
|
322
|
+
plugins: [react(), intlayer(), intlayerProxy()],
|
|
323
|
+
});
|
|
324
|
+
```
|
|
325
|
+
|
|
182
326
|
### (Optional) Step 8: Change the URL when the locale changes
|
|
183
327
|
|
|
184
328
|
[to complete]
|
|
@@ -189,7 +333,7 @@ module.exports = appContent;
|
|
|
189
333
|
|
|
190
334
|
### (Optional) Step 10: Creating a Localized Link Component
|
|
191
335
|
|
|
192
|
-
[to complete]
|
|
336
|
+
[to complete] -->
|
|
193
337
|
|
|
194
338
|
### Git Configuration
|
|
195
339
|
|
|
@@ -222,5 +366,3 @@ For more details on how to use the extension, refer to the [Intlayer VS Code Ext
|
|
|
222
366
|
### Go Further
|
|
223
367
|
|
|
224
368
|
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
|
|
225
|
-
|
|
226
|
-
---
|
|
@@ -139,23 +139,23 @@ Add the intlayer plugin into your configuration.
|
|
|
139
139
|
|
|
140
140
|
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
141
141
|
import { defineConfig } from "vite";
|
|
142
|
-
import
|
|
142
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
143
143
|
import { intlayer } from "vite-intlayer";
|
|
144
144
|
|
|
145
145
|
// https://vitejs.dev/config/
|
|
146
146
|
export default defineConfig({
|
|
147
|
-
plugins: [
|
|
147
|
+
plugins: [svelte(), intlayer()],
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
152
152
|
import { defineConfig } from "vite";
|
|
153
|
-
import
|
|
153
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
154
154
|
import { intlayer } from "vite-intlayer";
|
|
155
155
|
|
|
156
156
|
// https://vitejs.dev/config/
|
|
157
157
|
export default defineConfig({
|
|
158
|
-
plugins: [
|
|
158
|
+
plugins: [svelte(), intlayer()],
|
|
159
159
|
});
|
|
160
160
|
```
|
|
161
161
|
|
|
@@ -181,7 +181,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
181
181
|
|
|
182
182
|
const appContent = {
|
|
183
183
|
key: "app",
|
|
184
|
-
content: {
|
|
184
|
+
content: {
|
|
185
|
+
title: t({
|
|
186
|
+
en: "Hello World",
|
|
187
|
+
fr: "Bonjour le monde",
|
|
188
|
+
es: "Hola mundo",
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
185
191
|
} satisfies Dictionary;
|
|
186
192
|
|
|
187
193
|
export default appContent;
|
|
@@ -193,7 +199,13 @@ import { t } from "intlayer";
|
|
|
193
199
|
/** @type {import('intlayer').Dictionary} */
|
|
194
200
|
const appContent = {
|
|
195
201
|
key: "app",
|
|
196
|
-
content: {
|
|
202
|
+
content: {
|
|
203
|
+
title: t({
|
|
204
|
+
en: "Hello World",
|
|
205
|
+
fr: "Bonjour le monde",
|
|
206
|
+
es: "Hola mundo",
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
197
209
|
};
|
|
198
210
|
|
|
199
211
|
export default appContent;
|
|
@@ -205,7 +217,13 @@ const { t } = require("intlayer");
|
|
|
205
217
|
/** @type {import('intlayer').Dictionary} */
|
|
206
218
|
const appContent = {
|
|
207
219
|
key: "app",
|
|
208
|
-
content: {
|
|
220
|
+
content: {
|
|
221
|
+
title: t({
|
|
222
|
+
en: "Hello World",
|
|
223
|
+
fr: "Bonjour le monde",
|
|
224
|
+
es: "Hola mundo",
|
|
225
|
+
}),
|
|
226
|
+
},
|
|
209
227
|
};
|
|
210
228
|
|
|
211
229
|
module.exports = appContent;
|
|
@@ -215,7 +233,16 @@ module.exports = appContent;
|
|
|
215
233
|
{
|
|
216
234
|
"$schema": "https://intlayer.org/schema.json",
|
|
217
235
|
"key": "app",
|
|
218
|
-
"content": {
|
|
236
|
+
"content": {
|
|
237
|
+
"title": {
|
|
238
|
+
"nodeType": "translation",
|
|
239
|
+
"translation": {
|
|
240
|
+
"en": "Hello World",
|
|
241
|
+
"fr": "Bonjour le monde",
|
|
242
|
+
"es": "Hola mundo"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
219
246
|
}
|
|
220
247
|
```
|
|
221
248
|
|
|
@@ -142,23 +142,23 @@ Agrega el plugin intlayer en tu configuración.
|
|
|
142
142
|
|
|
143
143
|
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
144
144
|
import { defineConfig } from "vite";
|
|
145
|
-
import
|
|
145
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
146
146
|
import { intlayer } from "vite-intlayer";
|
|
147
147
|
|
|
148
148
|
// https://vitejs.dev/config/
|
|
149
149
|
export default defineConfig({
|
|
150
|
-
plugins: [
|
|
150
|
+
plugins: [svelte(), intlayer()],
|
|
151
151
|
});
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
155
155
|
import { defineConfig } from "vite";
|
|
156
|
-
import
|
|
156
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
157
157
|
import { intlayer } from "vite-intlayer";
|
|
158
158
|
|
|
159
159
|
// https://vitejs.dev/config/
|
|
160
160
|
export default defineConfig({
|
|
161
|
-
plugins: [
|
|
161
|
+
plugins: [svelte(), intlayer()],
|
|
162
162
|
});
|
|
163
163
|
```
|
|
164
164
|
|
|
@@ -184,7 +184,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
184
184
|
|
|
185
185
|
const appContent = {
|
|
186
186
|
key: "app",
|
|
187
|
-
content: {
|
|
187
|
+
content: {
|
|
188
|
+
title: t({
|
|
189
|
+
en: "Hello World",
|
|
190
|
+
fr: "Bonjour le monde",
|
|
191
|
+
es: "Hola mundo",
|
|
192
|
+
}),
|
|
193
|
+
},
|
|
188
194
|
} satisfies Dictionary;
|
|
189
195
|
|
|
190
196
|
export default appContent;
|
|
@@ -196,7 +202,13 @@ import { t } from "intlayer";
|
|
|
196
202
|
/** @type {import('intlayer').Dictionary} */
|
|
197
203
|
const appContent = {
|
|
198
204
|
key: "app",
|
|
199
|
-
content: {
|
|
205
|
+
content: {
|
|
206
|
+
title: t({
|
|
207
|
+
en: "Hello World",
|
|
208
|
+
fr: "Bonjour le monde",
|
|
209
|
+
es: "Hola mundo",
|
|
210
|
+
}),
|
|
211
|
+
},
|
|
200
212
|
};
|
|
201
213
|
|
|
202
214
|
export default appContent;
|
|
@@ -209,7 +221,13 @@ const { t } = require("intlayer");
|
|
|
209
221
|
// Declaración del contenido de la aplicación
|
|
210
222
|
const appContent = {
|
|
211
223
|
key: "app",
|
|
212
|
-
content: {
|
|
224
|
+
content: {
|
|
225
|
+
title: t({
|
|
226
|
+
en: "Hello World",
|
|
227
|
+
fr: "Bonjour le monde",
|
|
228
|
+
es: "Hola mundo",
|
|
229
|
+
}),
|
|
230
|
+
},
|
|
213
231
|
};
|
|
214
232
|
|
|
215
233
|
module.exports = appContent;
|
|
@@ -219,7 +237,16 @@ module.exports = appContent;
|
|
|
219
237
|
{
|
|
220
238
|
"$schema": "https://intlayer.org/schema.json",
|
|
221
239
|
"key": "app",
|
|
222
|
-
"content": {
|
|
240
|
+
"content": {
|
|
241
|
+
"title": {
|
|
242
|
+
"nodeType": "translation",
|
|
243
|
+
"translation": {
|
|
244
|
+
"en": "Hello World",
|
|
245
|
+
"fr": "Bonjour le monde",
|
|
246
|
+
"es": "Hola mundo"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
223
250
|
}
|
|
224
251
|
```
|
|
225
252
|
|
|
@@ -141,23 +141,23 @@ Ajoutez le plugin intlayer dans votre configuration.
|
|
|
141
141
|
|
|
142
142
|
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
143
143
|
import { defineConfig } from "vite";
|
|
144
|
-
import
|
|
144
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
145
145
|
import { intlayer } from "vite-intlayer";
|
|
146
146
|
|
|
147
147
|
// https://vitejs.dev/config/
|
|
148
148
|
export default defineConfig({
|
|
149
|
-
plugins: [
|
|
149
|
+
plugins: [svelte(), intlayer()],
|
|
150
150
|
});
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
154
154
|
import { defineConfig } from "vite";
|
|
155
|
-
import
|
|
155
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
156
156
|
import { intlayer } from "vite-intlayer";
|
|
157
157
|
|
|
158
158
|
// https://vitejs.dev/config/
|
|
159
159
|
export default defineConfig({
|
|
160
|
-
plugins: [
|
|
160
|
+
plugins: [svelte(), intlayer()],
|
|
161
161
|
});
|
|
162
162
|
```
|
|
163
163
|
|
|
@@ -183,7 +183,13 @@ import { t, type Dictionary } from "intlayer";
|
|
|
183
183
|
|
|
184
184
|
const appContent = {
|
|
185
185
|
key: "app",
|
|
186
|
-
content: {
|
|
186
|
+
content: {
|
|
187
|
+
title: t({
|
|
188
|
+
en: "Hello World",
|
|
189
|
+
fr: "Bonjour le monde",
|
|
190
|
+
es: "Hola mundo",
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
187
193
|
} satisfies Dictionary;
|
|
188
194
|
|
|
189
195
|
export default appContent;
|
|
@@ -195,7 +201,13 @@ import { t } from "intlayer";
|
|
|
195
201
|
/** @type {import('intlayer').Dictionary} */
|
|
196
202
|
const appContent = {
|
|
197
203
|
key: "app",
|
|
198
|
-
content: {
|
|
204
|
+
content: {
|
|
205
|
+
title: t({
|
|
206
|
+
en: "Hello World",
|
|
207
|
+
fr: "Bonjour le monde",
|
|
208
|
+
es: "Hola mundo",
|
|
209
|
+
}),
|
|
210
|
+
},
|
|
199
211
|
};
|
|
200
212
|
|
|
201
213
|
export default appContent;
|
|
@@ -208,7 +220,13 @@ const { t } = require("intlayer");
|
|
|
208
220
|
// Déclaration du contenu de l'application
|
|
209
221
|
const appContent = {
|
|
210
222
|
key: "app",
|
|
211
|
-
content: {
|
|
223
|
+
content: {
|
|
224
|
+
title: t({
|
|
225
|
+
en: "Hello World",
|
|
226
|
+
fr: "Bonjour le monde",
|
|
227
|
+
es: "Hola mundo",
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
212
230
|
};
|
|
213
231
|
|
|
214
232
|
module.exports = appContent;
|
|
@@ -218,7 +236,16 @@ module.exports = appContent;
|
|
|
218
236
|
{
|
|
219
237
|
"$schema": "https://intlayer.org/schema.json",
|
|
220
238
|
"key": "app",
|
|
221
|
-
"content": {
|
|
239
|
+
"content": {
|
|
240
|
+
"title": {
|
|
241
|
+
"nodeType": "translation",
|
|
242
|
+
"translation": {
|
|
243
|
+
"en": "Hello World",
|
|
244
|
+
"fr": "Bonjour le monde",
|
|
245
|
+
"es": "Hola mundo"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
222
249
|
}
|
|
223
250
|
```
|
|
224
251
|
|