@intlayer/docs 8.4.0-canary.0 → 8.4.1
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/blog/ar/per-component_vs_centralized_i18n.md +1 -1
- package/blog/de/i18n_using_next-i18next.md +1 -1
- package/blog/de/i18n_using_next-intl.md +1 -1
- package/blog/de/per-component_vs_centralized_i18n.md +1 -1
- package/blog/en/___per-component_vs_centralized_i18n.md +1 -1
- package/blog/en/per-component_vs_centralized_i18n.md +1 -1
- package/blog/en-GB/per-component_vs_centralized_i18n.md +1 -1
- package/blog/es/per-component_vs_centralized_i18n.md +1 -1
- package/blog/fr/i18n_using_next-i18next.md +1 -1
- package/blog/fr/i18n_using_next-intl.md +1 -1
- package/blog/fr/per-component_vs_centralized_i18n.md +1 -1
- package/blog/hi/i18n_using_next-i18next.md +1 -1
- package/blog/hi/i18n_using_next-intl.md +1 -1
- package/blog/hi/per-component_vs_centralized_i18n.md +1 -1
- package/blog/id/per-component_vs_centralized_i18n.md +1 -1
- package/blog/ja/per-component_vs_centralized_i18n.md +1 -1
- package/blog/ko/i18n_using_next-i18next.md +1 -1
- package/blog/ko/i18n_using_next-intl.md +1 -1
- package/blog/ko/per-component_vs_centralized_i18n.md +1 -1
- package/blog/pl/per-component_vs_centralized_i18n.md +1 -1
- package/blog/pt/per-component_vs_centralized_i18n.md +1 -1
- package/blog/ru/per-component_vs_centralized_i18n.md +1 -1
- package/blog/tr/i18n_using_next-i18next.md +1 -1
- package/blog/tr/i18n_using_next-intl.md +1 -1
- package/blog/tr/per-component_vs_centralized_i18n.md +1 -1
- package/blog/uk/per-component_vs_centralized_i18n.md +2 -2
- package/blog/vi/per-component_vs_centralized_i18n.md +1 -1
- package/dist/cjs/blog.cjs +1 -1
- package/dist/cjs/blog.cjs.map +1 -1
- package/dist/cjs/common-a-l0ULP6.cjs +2 -0
- package/dist/cjs/common-a-l0ULP6.cjs.map +1 -0
- package/dist/cjs/common.cjs +1 -2
- package/dist/cjs/doc.cjs +1 -1
- package/dist/cjs/doc.cjs.map +1 -1
- package/dist/cjs/frequentQuestions.cjs +1 -1
- package/dist/cjs/frequentQuestions.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +1 -1
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +1 -1
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +1 -1
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/cjs/legal.cjs +1 -1
- package/dist/cjs/legal.cjs.map +1 -1
- package/dist/types/blog.d.ts +2 -2
- package/dist/types/blog.entry-D5IgxPXY.d.ts +35 -0
- package/dist/types/blog.entry-D5IgxPXY.d.ts.map +1 -0
- package/dist/types/common-B45TZvLQ.d.ts +37 -0
- package/dist/types/common-B45TZvLQ.d.ts.map +1 -0
- package/dist/types/common.d.ts +2 -37
- package/dist/types/doc.d.ts +2 -2
- package/dist/types/docs.entry-CergjAYt.d.ts +157 -0
- package/dist/types/docs.entry-CergjAYt.d.ts.map +1 -0
- package/dist/types/frequentQuestions.d.ts +2 -2
- package/dist/types/frequentQuestions.entry-BHglVS-U.d.ts +24 -0
- package/dist/types/frequentQuestions.entry-BHglVS-U.d.ts.map +1 -0
- package/dist/types/generated/blog.entry.d.ts +2 -35
- package/dist/types/generated/docs.entry.d.ts +2 -157
- package/dist/types/generated/frequentQuestions.entry.d.ts +2 -24
- package/dist/types/generated/legal.entry.d.ts +2 -10
- package/dist/types/legal.d.ts +2 -2
- package/dist/types/legal.entry-B5Lg5eeH.d.ts +10 -0
- package/dist/types/legal.entry-B5Lg5eeH.d.ts.map +1 -0
- package/docs/ar/intlayer_with_adonisjs.md +3 -3
- package/docs/ar/intlayer_with_svelte_kit.md +5 -12
- package/docs/ar/intlayer_with_tanstack.md +3 -3
- package/docs/ar/intlayer_with_vite+svelte.md +0 -8
- package/docs/de/intlayer_with_adonisjs.md +3 -3
- package/docs/de/intlayer_with_svelte_kit.md +5 -12
- package/docs/de/intlayer_with_tanstack.md +3 -3
- package/docs/de/intlayer_with_vite+svelte.md +0 -8
- package/docs/en/intlayer_with_adonisjs.md +3 -3
- package/docs/en/intlayer_with_svelte_kit.md +5 -12
- package/docs/en/intlayer_with_tanstack.md +3 -3
- package/docs/en/intlayer_with_vite+svelte.md +0 -8
- package/docs/en-GB/intlayer_with_adonisjs.md +3 -3
- package/docs/en-GB/intlayer_with_svelte_kit.md +9 -10
- package/docs/en-GB/intlayer_with_tanstack.md +3 -3
- package/docs/en-GB/intlayer_with_vite+svelte.md +0 -8
- package/docs/es/intlayer_with_adonisjs.md +3 -3
- package/docs/es/intlayer_with_svelte_kit.md +5 -12
- package/docs/es/intlayer_with_tanstack.md +3 -3
- package/docs/es/intlayer_with_vite+svelte.md +0 -8
- package/docs/fr/intlayer_with_adonisjs.md +3 -3
- package/docs/fr/intlayer_with_svelte_kit.md +5 -12
- package/docs/fr/intlayer_with_vite+svelte.md +0 -8
- package/docs/hi/intlayer_with_adonisjs.md +3 -3
- package/docs/hi/intlayer_with_svelte_kit.md +5 -12
- package/docs/hi/intlayer_with_tanstack.md +3 -3
- package/docs/hi/intlayer_with_vite+svelte.md +0 -8
- package/docs/id/intlayer_with_adonisjs.md +3 -3
- package/docs/id/intlayer_with_svelte_kit.md +5 -12
- package/docs/id/intlayer_with_tanstack.md +3 -3
- package/docs/id/intlayer_with_vite+svelte.md +0 -8
- package/docs/it/intlayer_with_adonisjs.md +3 -3
- package/docs/it/intlayer_with_svelte_kit.md +5 -12
- package/docs/it/intlayer_with_tanstack.md +3 -3
- package/docs/it/intlayer_with_vite+svelte.md +0 -8
- package/docs/ja/intlayer_with_adonisjs.md +3 -3
- package/docs/ja/intlayer_with_vite+svelte.md +0 -8
- package/docs/ko/intlayer_with_adonisjs.md +3 -3
- package/docs/ko/intlayer_with_svelte_kit.md +5 -12
- package/docs/ko/intlayer_with_tanstack.md +3 -3
- package/docs/ko/intlayer_with_vite+svelte.md +0 -8
- package/docs/pl/intlayer_with_svelte_kit.md +5 -12
- package/docs/pl/intlayer_with_tanstack.md +3 -3
- package/docs/pl/intlayer_with_vite+svelte.md +0 -8
- package/docs/pt/intlayer_with_adonisjs.md +3 -3
- package/docs/pt/intlayer_with_svelte_kit.md +5 -12
- package/docs/pt/intlayer_with_tanstack.md +3 -3
- package/docs/pt/intlayer_with_vite+svelte.md +0 -8
- package/docs/ru/intlayer_with_adonisjs.md +3 -3
- package/docs/ru/intlayer_with_svelte_kit.md +5 -12
- package/docs/ru/intlayer_with_tanstack.md +3 -3
- package/docs/ru/intlayer_with_vite+svelte.md +0 -8
- package/docs/ru/packages/intlayer/getCanonicalPath.md +1 -1
- package/docs/tr/intlayer_with_adonisjs.md +3 -3
- package/docs/tr/intlayer_with_svelte_kit.md +5 -12
- package/docs/tr/intlayer_with_tanstack.md +3 -3
- package/docs/tr/intlayer_with_vite+svelte.md +0 -8
- package/docs/uk/intlayer_with_adonisjs.md +3 -3
- package/docs/uk/intlayer_with_svelte_kit.md +5 -12
- package/docs/uk/intlayer_with_tanstack.md +3 -3
- package/docs/uk/intlayer_with_vite+svelte.md +0 -8
- package/docs/uk/packages/express-intlayer/t.md +1 -1
- package/docs/uk/packages/intlayer/getHTMLTextDir.md +1 -1
- package/docs/uk/packages/intlayer/getLocalizedUrl.md +1 -1
- package/docs/uk/packages/react-intlayer/t.md +1 -1
- package/docs/vi/intlayer_with_adonisjs.md +2 -2
- package/docs/vi/intlayer_with_svelte_kit.md +5 -12
- package/docs/vi/intlayer_with_tanstack.md +3 -3
- package/docs/vi/intlayer_with_vite+svelte.md +0 -8
- package/docs/zh/intlayer_with_adonisjs.md +3 -3
- package/docs/zh/intlayer_with_svelte_kit.md +5 -12
- package/docs/zh/intlayer_with_tanstack.md +3 -3
- package/docs/zh/intlayer_with_vite+svelte.md +0 -8
- package/frequent_questions/fr/error-vite-env-only.md +1 -1
- package/frequent_questions/id/error-vite-env-only.md +1 -1
- package/frequent_questions/pl/error-vite-env-only.md +1 -1
- package/frequent_questions/pt/error-vite-env-only.md +1 -1
- package/package.json +7 -7
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/cjs/common.cjs.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/generated/blog.entry.d.ts.map +0 -1
- package/dist/types/generated/docs.entry.d.ts.map +0 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +0 -1
- package/dist/types/generated/legal.entry.d.ts.map +0 -1
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ Durch die Internationalisierung des Backends respektiert Ihre Anwendung nicht nu
|
|
|
42
42
|
## Erste Schritte
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
See [Application Template](https://github.com/aymericzip/intlayer-
|
|
52
|
+
See [Application Template](https://github.com/aymericzip/intlayer-adonis-template) on GitHub.
|
|
53
53
|
|
|
54
54
|
### Installation
|
|
55
55
|
|
|
@@ -494,14 +494,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
494
494
|
|
|
495
495
|
Wenn die Locale nicht konfiguriert ist, möchten wir einen 404-Fehler zurückgeben. Um dies zu erleichtern, können wir eine `match`-Funktion erstellen, um zu überprüfen, ob die Locale gültig ist:
|
|
496
496
|
|
|
497
|
-
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
export const match = (
|
|
501
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
497
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
498
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
499
|
+
locales.includes(param);
|
|
505
500
|
```
|
|
506
501
|
|
|
507
502
|
> **Hinweis:** Stellen Sie sicher, dass Ihre `src/app.d.ts` die Locale-Definition enthält:
|
|
@@ -540,15 +535,13 @@ Erstellen Sie dann eine neue Seite und ein Layout unter der Gruppe `[[locale=loc
|
|
|
540
535
|
|
|
541
536
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
537
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
538
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
539
|
|
|
545
540
|
export const prerender = true;
|
|
546
541
|
|
|
547
542
|
// Verwenden Sie den generischen Load-Typ
|
|
548
543
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
544
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
545
|
|
|
553
546
|
return {
|
|
554
547
|
locale,
|
|
@@ -24,13 +24,13 @@ history:
|
|
|
24
24
|
changes: Init-Befehl hinzufügen
|
|
25
25
|
- version: 7.4.0
|
|
26
26
|
date: 2025-12-11
|
|
27
|
-
changes: Einführung von validatePrefix und Hinzufügen von Schritt 14: Behandlung von 404-Seiten mit lokalisierten Routen.
|
|
27
|
+
changes: "Einführung von validatePrefix und Hinzufügen von Schritt 14: Behandlung von 404-Seiten mit lokalisierten Routen."
|
|
28
28
|
- version: 7.3.9
|
|
29
29
|
date: 2025-12-05
|
|
30
|
-
changes: Schritt 13 hinzugefügt: Abrufen der Locale in Ihren Serveraktionen (Optional)
|
|
30
|
+
changes: "Schritt 13 hinzugefügt: Abrufen der Locale in Ihren Serveraktionen (Optional)"
|
|
31
31
|
- version: 7.2.3
|
|
32
32
|
date: 2025-11-18
|
|
33
|
-
changes: Schritt 13 hinzugefügt: Nitro anpassen
|
|
33
|
+
changes: "Schritt 13 hinzugefügt: Nitro anpassen"
|
|
34
34
|
- version: 7.1.0
|
|
35
35
|
date: 2025-11-17
|
|
36
36
|
changes: Präfix-Standard durch Hinzufügen der getPrefix-Funktion, useLocalizedNavigate, LocaleSwitcher und LocalizedLink korrigiert.
|
|
@@ -296,14 +296,6 @@ Um den intlayer Editor einzurichten, müssen Sie der [intlayer Editor Dokumentat
|
|
|
296
296
|
|
|
297
297
|
Um das intlayer CMS einzurichten, müssen Sie der [intlayer CMS Dokumentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_CMS.md) folgen.
|
|
298
298
|
|
|
299
|
-
Parallel dazu müssen Sie in Ihrer Svelte-Anwendung die folgende Zeile in einem Layout oder im Root Ihrer Anwendung hinzufügen:
|
|
300
|
-
|
|
301
|
-
```svelte fileName="src/layout.svelte"
|
|
302
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
303
|
-
|
|
304
|
-
useIntlayerEditor();
|
|
305
|
-
```
|
|
306
|
-
|
|
307
299
|
### (Optional) Schritt 7: Lokalisierte Routing zu Ihrer Anwendung hinzufügen
|
|
308
300
|
|
|
309
301
|
Um lokalisierte Routen in Ihrer Svelte-Anwendung zu verwalten, können Sie `svelte-spa-router` zusammen mit Intlayers `localeFlatMap` verwenden, um Routen für jede Locale zu generieren.
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ By internationalizing the backend, your application not only respects cultural d
|
|
|
42
42
|
## Getting Started
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
See [Application Template](https://github.com/aymericzip/intlayer-
|
|
52
|
+
See [Application Template](https://github.com/aymericzip/intlayer-adonis-template) on GitHub.
|
|
53
53
|
|
|
54
54
|
### Installation
|
|
55
55
|
|
|
@@ -322,14 +322,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
322
322
|
|
|
323
323
|
If the locale is not configured, we want to return a 404 error. To make it easier, we can create a `match` function to check if the locale is valid:
|
|
324
324
|
|
|
325
|
-
```ts fileName="/src/params/locale.ts"
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
export const match = (
|
|
329
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
330
|
-
): boolean => {
|
|
331
|
-
return configuration.internationalization.locales.includes(param);
|
|
332
|
-
};
|
|
325
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
326
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
327
|
+
locales.includes(param);
|
|
333
328
|
```
|
|
334
329
|
|
|
335
330
|
> **Note:** Ensure your `src/app.d.ts` includes the locale definition:
|
|
@@ -368,15 +363,13 @@ Then, create a new page and layout under the `[[locale=locale]]` group:
|
|
|
368
363
|
|
|
369
364
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
370
365
|
import type { Load } from "@sveltejs/kit";
|
|
371
|
-
import {
|
|
366
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
372
367
|
|
|
373
368
|
export const prerender = true;
|
|
374
369
|
|
|
375
370
|
// Use the generic Load type
|
|
376
371
|
export const load: Load = ({ params }) => {
|
|
377
|
-
const locale: Locale =
|
|
378
|
-
(params.locale as Locale) ??
|
|
379
|
-
configuration.internationalization.defaultLocale;
|
|
372
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
380
373
|
|
|
381
374
|
return {
|
|
382
375
|
locale,
|
|
@@ -24,13 +24,13 @@ history:
|
|
|
24
24
|
changes: Add init command
|
|
25
25
|
- version: 7.4.0
|
|
26
26
|
date: 2025-12-11
|
|
27
|
-
changes: Introduce validatePrefix and add step 14
|
|
27
|
+
changes: Introduce validatePrefix and add step 14 - Handling 404 pages with localized routes.
|
|
28
28
|
- version: 7.3.9
|
|
29
29
|
date: 2025-12-05
|
|
30
|
-
changes: Add step 13
|
|
30
|
+
changes: Add step 13 - Retrieve the locale in your server actions (Optional)
|
|
31
31
|
- version: 7.2.3
|
|
32
32
|
date: 2025-11-18
|
|
33
|
-
changes: Add step 13
|
|
33
|
+
changes: Add step 13 - Adapt Nitro
|
|
34
34
|
- version: 7.1.0
|
|
35
35
|
date: 2025-11-17
|
|
36
36
|
changes: Fix prefix default by adding getPrefix function useLocalizedNavigate, LocaleSwitcher and LocalizedLink.
|
|
@@ -312,14 +312,6 @@ To set up the intlayer editor, you must follow the [intlayer editor documentatio
|
|
|
312
312
|
|
|
313
313
|
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).
|
|
314
314
|
|
|
315
|
-
In parallel, in your Svelte application, you must add the following line in a layout, or at the root of your application:
|
|
316
|
-
|
|
317
|
-
```svelte fileName="src/layout.svelte"
|
|
318
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
319
|
-
|
|
320
|
-
useIntlayerEditor();
|
|
321
|
-
```
|
|
322
|
-
|
|
323
315
|
### (Optional) Step 7: Add localized Routing to your application
|
|
324
316
|
|
|
325
317
|
To handle localized routing in your Svelte application, you can use `svelte-spa-router` along with Intlayer's `localeFlatMap` to generate routes for each locale.
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ By internationalising the backend, your application not only respects cultural d
|
|
|
42
42
|
## Getting Started
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
See [Application Template](https://github.com/aymericzip/intlayer-
|
|
52
|
+
See [Application Template](https://github.com/aymericzip/intlayer-adonis-template) on GitHub.
|
|
53
53
|
|
|
54
54
|
### Installation
|
|
55
55
|
|
|
@@ -495,13 +495,10 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
495
495
|
If the locale is not configured, we want to return a 404 error. To simplify this, we can create a `match` function to verify if the locale is valid:
|
|
496
496
|
|
|
497
497
|
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
import {
|
|
498
|
+
import { defaultLocale, locales, type Locale } from "intlayer";
|
|
499
499
|
|
|
500
|
-
export const match = (
|
|
501
|
-
param
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
500
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
501
|
+
locales.includes(param);
|
|
505
502
|
```
|
|
506
503
|
|
|
507
504
|
> **Note:** Ensure your `src/app.d.ts` includes the locale definition:
|
|
@@ -540,15 +537,13 @@ Then, create a new page and layout under the `[[locale=locale]]` group:
|
|
|
540
537
|
|
|
541
538
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
539
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
540
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
541
|
|
|
545
542
|
export const prerender = true;
|
|
546
543
|
|
|
547
544
|
// Use the generic Load type
|
|
548
545
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
546
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
547
|
|
|
553
548
|
return {
|
|
554
549
|
locale,
|
|
@@ -748,3 +743,7 @@ It is recommended to ignore the files generated by Intlayer.
|
|
|
748
743
|
|
|
749
744
|
- **Visual Editor**: Integrate the [Intlayer Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_visual_editor.md) to edit translations directly from the UI.
|
|
750
745
|
- **CMS**: Externalise your content management using the [Intlayer CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_CMS.md).
|
|
746
|
+
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
```
|
|
@@ -24,13 +24,13 @@ history:
|
|
|
24
24
|
changes: Add init command
|
|
25
25
|
- version: 7.4.0
|
|
26
26
|
date: 2025-12-11
|
|
27
|
-
changes: Introduce validatePrefix and add step 14: Handling 404 pages with localised routes.
|
|
27
|
+
changes: "Introduce validatePrefix and add step 14: Handling 404 pages with localised routes."
|
|
28
28
|
- version: 7.3.9
|
|
29
29
|
date: 2025-12-05
|
|
30
|
-
changes: Add step 13: Retrieve the locale in your server actions (Optional)
|
|
30
|
+
changes: "Add step 13: Retrieve the locale in your server actions (Optional)"
|
|
31
31
|
- version: 7.2.3
|
|
32
32
|
date: 2025-11-18
|
|
33
|
-
changes: Add step 13: Adapt Nitro
|
|
33
|
+
changes: "Add step 13: Adapt Nitro"
|
|
34
34
|
- version: 7.1.0
|
|
35
35
|
date: 2025-11-17
|
|
36
36
|
changes: Fix prefix default by adding getPrefix function useLocalizedNavigate, LocaleSwitcher and LocalisedLink.
|
|
@@ -293,14 +293,6 @@ To set up the intlayer editor, you must follow the [intlayer editor documentatio
|
|
|
293
293
|
|
|
294
294
|
To set up the intlayer CMS, you must follow the [intlayer CMS documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_CMS.md).
|
|
295
295
|
|
|
296
|
-
In parallel, in your Svelte application, you must add the following line in a layout, or at the root of your application:
|
|
297
|
-
|
|
298
|
-
```svelte fileName="src/layout.svelte"
|
|
299
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
300
|
-
|
|
301
|
-
useIntlayerEditor();
|
|
302
|
-
```
|
|
303
|
-
|
|
304
296
|
### (Optional) Step 7: Add localised Routing to your application
|
|
305
297
|
|
|
306
298
|
To handle localised routing in your Svelte application, you can use `svelte-spa-router` along with Intlayer's `localeFlatMap` to generate routes for each locale.
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ Al internacionalizar el backend, tu aplicación no solo respeta las diferencias
|
|
|
42
42
|
## Primeros Pasos
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - Cómo internacionalizar tu aplicación usando Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
Ver la [Plantilla de la Aplicación](https://github.com/aymericzip/intlayer-
|
|
52
|
+
Ver la [Plantilla de la Aplicación](https://github.com/aymericzip/intlayer-adonis-template) en GitHub.
|
|
53
53
|
|
|
54
54
|
### Instalación
|
|
55
55
|
|
|
@@ -494,14 +494,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
494
494
|
|
|
495
495
|
Si la localidad no está configurada, queremos devolver un error 404. Para facilitarlo, podemos crear una función `match` para verificar si la localidad es válida:
|
|
496
496
|
|
|
497
|
-
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
export const match = (
|
|
501
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
497
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
498
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
499
|
+
locales.includes(param);
|
|
505
500
|
```
|
|
506
501
|
|
|
507
502
|
> **Nota:** Asegúrate de que tu `src/app.d.ts` incluya la definición de la localidad:
|
|
@@ -540,15 +535,13 @@ Luego, crea una nueva página y layout bajo el grupo `[[locale=locale]]`:
|
|
|
540
535
|
|
|
541
536
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
537
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
538
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
539
|
|
|
545
540
|
export const prerender = true;
|
|
546
541
|
|
|
547
542
|
// Usa el tipo genérico Load
|
|
548
543
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
544
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
545
|
|
|
553
546
|
return {
|
|
554
547
|
locale,
|
|
@@ -24,13 +24,13 @@ history:
|
|
|
24
24
|
changes: Añadir comando init
|
|
25
25
|
- version: 7.4.0
|
|
26
26
|
date: 2025-12-11
|
|
27
|
-
changes: Introducir validatePrefix y añadir el paso 14: Gestión de páginas 404 con rutas localizadas.
|
|
27
|
+
changes: "Introducir validatePrefix y añadir el paso 14: Gestión de páginas 404 con rutas localizadas."
|
|
28
28
|
- version: 7.3.9
|
|
29
29
|
date: 2025-12-05
|
|
30
|
-
changes: Añadir el paso 13: Obtener la configuración regional en tus acciones del servidor (Opcional)
|
|
30
|
+
changes: "Añadir el paso 13: Obtener la configuración regional en tus acciones del servidor (Opcional)"
|
|
31
31
|
- version: 7.2.3
|
|
32
32
|
date: 2025-11-18
|
|
33
|
-
changes: Añadir el paso 13: Adaptar Nitro
|
|
33
|
+
changes: "Añadir el paso 13: Adaptar Nitro"
|
|
34
34
|
- version: 7.1.0
|
|
35
35
|
date: 2025-11-17
|
|
36
36
|
changes: Corregir prefijo por defecto añadiendo la función getPrefix, useLocalizedNavigate, LocaleSwitcher y LocalizedLink.
|
|
@@ -295,14 +295,6 @@ Para configurar el editor de intlayer, debes seguir la [documentación del edito
|
|
|
295
295
|
|
|
296
296
|
Para configurar el CMS de intlayer, debes seguir la [documentación del CMS de intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_CMS.md).
|
|
297
297
|
|
|
298
|
-
En paralelo, en tu aplicación Svelte, debes agregar la siguiente línea en un layout, o en la raíz de tu aplicación:
|
|
299
|
-
|
|
300
|
-
```svelte fileName="src/layout.svelte"
|
|
301
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
302
|
-
|
|
303
|
-
useIntlayerEditor();
|
|
304
|
-
```
|
|
305
|
-
|
|
306
298
|
### (Opcional) Paso 7: Añadir enrutamiento localizado a tu aplicación
|
|
307
299
|
|
|
308
300
|
Para manejar el enrutamiento localizado en tu aplicación Svelte, puedes usar `svelte-spa-router` junto con `localeFlatMap` de Intlayer para generar rutas para cada locale.
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ En internationalisant le backend, votre application non seulement respecte les d
|
|
|
42
42
|
## Commencer
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Démo CodeSandbox - Comment internationaliser votre application avec Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
Voir le [Modèle d’Application](https://github.com/aymericzip/intlayer-
|
|
52
|
+
Voir le [Modèle d’Application](https://github.com/aymericzip/intlayer-adonis-template) sur GitHub.
|
|
53
53
|
|
|
54
54
|
### Installation
|
|
55
55
|
|
|
@@ -494,14 +494,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
494
494
|
|
|
495
495
|
Si la locale n'est pas configurée, nous souhaitons retourner une erreur 404. Pour faciliter cela, nous pouvons créer une fonction `match` pour vérifier si la locale est valide :
|
|
496
496
|
|
|
497
|
-
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
export const match = (
|
|
501
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
497
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
498
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
499
|
+
locales.includes(param);
|
|
505
500
|
```
|
|
506
501
|
|
|
507
502
|
> **Note :** Assurez-vous que votre fichier `src/app.d.ts` inclut la définition de la locale :
|
|
@@ -540,15 +535,13 @@ Ensuite, créez une nouvelle page et un layout sous le groupe `[[locale=locale]]
|
|
|
540
535
|
|
|
541
536
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
537
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
538
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
539
|
|
|
545
540
|
export const prerender = true;
|
|
546
541
|
|
|
547
542
|
// Utilisez le type générique Load
|
|
548
543
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
544
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
545
|
|
|
553
546
|
return {
|
|
554
547
|
locale,
|
|
@@ -295,14 +295,6 @@ Pour configurer l’éditeur intlayer, vous devez suivre la [documentation de l
|
|
|
295
295
|
|
|
296
296
|
Pour configurer le CMS intlayer, vous devez suivre la [documentation du CMS intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_CMS.md).
|
|
297
297
|
|
|
298
|
-
En parallèle, dans votre application Svelte, vous devez ajouter la ligne suivante dans un layout, ou à la racine de votre application :
|
|
299
|
-
|
|
300
|
-
```svelte fileName="src/layout.svelte"
|
|
301
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
302
|
-
|
|
303
|
-
useIntlayerEditor();
|
|
304
|
-
```
|
|
305
|
-
|
|
306
298
|
### (Optionnel) Étape 7 : Ajouter le routage localisé à votre application
|
|
307
299
|
|
|
308
300
|
Pour gérer le routage localisé dans votre application Svelte, vous pouvez utiliser `svelte-spa-router` avec `localeFlatMap` d'Intlayer pour générer les routes pour chaque locale.
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ history:
|
|
|
42
42
|
## शुरू करना
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
See [Application Template](https://github.com/aymericzip/intlayer-
|
|
52
|
+
See [Application Template](https://github.com/aymericzip/intlayer-adonis-template) on GitHub.
|
|
53
53
|
|
|
54
54
|
### स्थापना
|
|
55
55
|
|
|
@@ -494,14 +494,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
494
494
|
|
|
495
495
|
यदि locale कॉन्फ़िगर नहीं किया गया है, तो हम 404 त्रुटि लौटाना चाहते हैं। इसे आसान बनाने के लिए, हम एक `match` फ़ंक्शन बना सकते हैं जो जांचे कि locale मान्य है या नहीं:
|
|
496
496
|
|
|
497
|
-
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
export const match = (
|
|
501
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
497
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
498
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
499
|
+
locales.includes(param);
|
|
505
500
|
```
|
|
506
501
|
|
|
507
502
|
> **नोट:** सुनिश्चित करें कि आपकी `src/app.d.ts` में locale परिभाषा शामिल है:
|
|
@@ -540,15 +535,13 @@ export const match = (
|
|
|
540
535
|
|
|
541
536
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
537
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
538
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
539
|
|
|
545
540
|
export const prerender = true;
|
|
546
541
|
|
|
547
542
|
// सामान्य Load टाइप का उपयोग करें
|
|
548
543
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
544
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
545
|
|
|
553
546
|
return {
|
|
554
547
|
locale,
|
|
@@ -24,13 +24,13 @@ history:
|
|
|
24
24
|
changes: init कमांड जोड़ें
|
|
25
25
|
- version: 7.4.0
|
|
26
26
|
date: 2025-12-11
|
|
27
|
-
changes: validatePrefix पेश करें और चरण 14 जोड़ें: स्थानीयकृत रूट्स के साथ 404 पेज हैंडल करना।
|
|
27
|
+
changes: "validatePrefix पेश करें और चरण 14 जोड़ें: स्थानीयकृत रूट्स के साथ 404 पेज हैंडल करना।"
|
|
28
28
|
- version: 7.3.9
|
|
29
29
|
date: 2025-12-05
|
|
30
|
-
changes: चरण 13 जोड़ें: अपने सर्वर एक्शन्स में लोकेल प्राप्त करें (वैकल्पिक)
|
|
30
|
+
changes: "चरण 13 जोड़ें: अपने सर्वर एक्शन्स में लोकेल प्राप्त करें (वैकल्पिक)"
|
|
31
31
|
- version: 7.2.3
|
|
32
32
|
date: 2025-11-18
|
|
33
|
-
changes: चरण 13 जोड़ें: Nitro को अनुकूलित करें
|
|
33
|
+
changes: "चरण 13 जोड़ें: Nitro को अनुकूलित करें"
|
|
34
34
|
- version: 7.1.0
|
|
35
35
|
date: 2025-11-17
|
|
36
36
|
changes: getPrefix फ़ंक्शन जोड़कर उपसर्ग डिफ़ॉल्ट को ठीक करें useLocalizedNavigate, LocaleSwitcher और LocalizedLink का उपयोग करें।
|
|
@@ -296,14 +296,6 @@ intlayer संपादक सेट करने के लिए, आपक
|
|
|
296
296
|
|
|
297
297
|
intlayer CMS सेट करने के लिए, आपको [intlayer CMS दस्तावेज़](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_CMS.md) का पालन करना होगा।
|
|
298
298
|
|
|
299
|
-
साथ ही, अपनी Svelte एप्लिकेशन में, आपको निम्नलिखित लाइन को किसी लेआउट में या अपनी एप्लिकेशन की रूट में जोड़ना होगा:
|
|
300
|
-
|
|
301
|
-
```svelte fileName="src/layout.svelte"
|
|
302
|
-
import { useIntlayerEditor } from "svelte-intlayer";
|
|
303
|
-
|
|
304
|
-
useIntlayerEditor();
|
|
305
|
-
```
|
|
306
|
-
|
|
307
299
|
### (वैकल्पिक) चरण 7: अपनी एप्लिकेशन में स्थानीयकृत रूटिंग जोड़ें
|
|
308
300
|
|
|
309
301
|
अपनी Svelte एप्लिकेशन में स्थानीयकृत रूटिंग को संभालने के लिए, आप `svelte-spa-router` का उपयोग Intlayer के `localeFlatMap` के साथ कर सकते हैं ताकि प्रत्येक लोकल के लिए रूट्स जनरेट किए जा सकें।
|
|
@@ -14,7 +14,7 @@ slugs:
|
|
|
14
14
|
- doc
|
|
15
15
|
- environment
|
|
16
16
|
- adonisjs
|
|
17
|
-
applicationTemplate: https://github.com/aymericzip/intlayer-
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-adonis-template
|
|
18
18
|
history:
|
|
19
19
|
- version: 8.0.0
|
|
20
20
|
date: 2025-12-30
|
|
@@ -42,14 +42,14 @@ Dengan menginternasionalkan backend, aplikasi Anda tidak hanya menghormati perbe
|
|
|
42
42
|
## Memulai
|
|
43
43
|
|
|
44
44
|
<iframe
|
|
45
|
-
src="https://stackblitz.com/github/aymericzip/intlayer-
|
|
45
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-adonis-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
46
46
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
47
47
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
48
48
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
49
49
|
loading="lazy"
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
|
-
Lihat [Application Template](https://github.com/aymericzip/intlayer-
|
|
52
|
+
Lihat [Application Template](https://github.com/aymericzip/intlayer-adonis-template) di GitHub.
|
|
53
53
|
|
|
54
54
|
### Instalasi
|
|
55
55
|
|
|
@@ -494,14 +494,9 @@ export const getLocale = (event: RequestEvent): Locale => {
|
|
|
494
494
|
|
|
495
495
|
Jika locale tidak dikonfigurasi, kita ingin mengembalikan error 404. Untuk mempermudah, kita dapat membuat fungsi `match` untuk memeriksa apakah locale valid:
|
|
496
496
|
|
|
497
|
-
```ts fileName="/src/params/locale.ts"
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
export const match = (
|
|
501
|
-
param: Locale = configuration.internationalization.defaultLocale
|
|
502
|
-
): boolean => {
|
|
503
|
-
return configuration.internationalization.locales.includes(param);
|
|
504
|
-
};
|
|
497
|
+
```ts fileName="/src/params/locale.ts"import { defaultLocale, locales, type Locale } from "intlayer";
|
|
498
|
+
export const match = (param: Locale = defaultLocale): boolean =>
|
|
499
|
+
locales.includes(param);
|
|
505
500
|
```
|
|
506
501
|
|
|
507
502
|
> **Catatan:** Pastikan `src/app.d.ts` Anda menyertakan definisi locale:
|
|
@@ -540,15 +535,13 @@ Kemudian, buat halaman dan layout baru di bawah grup `[[locale=locale]]`:
|
|
|
540
535
|
|
|
541
536
|
```ts fileName="src/routes/[[locale=locale]]/+layout.ts"
|
|
542
537
|
import type { Load } from "@sveltejs/kit";
|
|
543
|
-
import {
|
|
538
|
+
import { defaultLocale, type Locale } from "intlayer";
|
|
544
539
|
|
|
545
540
|
export const prerender = true;
|
|
546
541
|
|
|
547
542
|
// Gunakan tipe Load generik
|
|
548
543
|
export const load: Load = ({ params }) => {
|
|
549
|
-
const locale: Locale =
|
|
550
|
-
(params.locale as Locale) ??
|
|
551
|
-
configuration.internationalization.defaultLocale;
|
|
544
|
+
const locale: Locale = (params.locale as Locale) ?? defaultLocale;
|
|
552
545
|
|
|
553
546
|
return {
|
|
554
547
|
locale,
|