@intlayer/docs 8.3.0-canary.4 → 8.3.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/docs/ar/compiler.md +84 -49
- package/docs/ar/configuration.md +80 -37
- package/docs/ar/intlayer_with_nextjs_16.md +174 -1
- package/docs/ar/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ar/intlayer_with_react_router_v7.md +224 -1
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ar/intlayer_with_svelte_kit.md +175 -2
- package/docs/ar/intlayer_with_tanstack.md +176 -1
- package/docs/ar/intlayer_with_vite+preact.md +174 -1
- package/docs/ar/intlayer_with_vite+react.md +174 -1
- package/docs/ar/intlayer_with_vite+solid.md +174 -1
- package/docs/ar/intlayer_with_vite+svelte.md +174 -1
- package/docs/ar/intlayer_with_vite+vue.md +174 -1
- package/docs/de/compiler.md +83 -48
- package/docs/de/configuration.md +434 -212
- package/docs/de/intlayer_with_nextjs_16.md +176 -1
- package/docs/de/intlayer_with_nextjs_compiler.md +106 -349
- package/docs/de/intlayer_with_react_router_v7.md +225 -2
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +221 -79
- package/docs/de/intlayer_with_svelte_kit.md +158 -2
- package/docs/de/intlayer_with_tanstack.md +159 -1
- package/docs/de/intlayer_with_vite+preact.md +157 -1
- package/docs/de/intlayer_with_vite+react.md +157 -1
- package/docs/de/intlayer_with_vite+solid.md +159 -3
- package/docs/de/intlayer_with_vite+svelte.md +157 -1
- package/docs/de/intlayer_with_vite+vue.md +157 -1
- package/docs/en/compiler.md +60 -33
- package/docs/en/configuration.md +80 -57
- package/docs/en/intlayer_with_nextjs_16.md +176 -0
- package/docs/en/intlayer_with_nextjs_compiler.md +179 -1
- package/docs/en/intlayer_with_react_router_v7.md +159 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +159 -0
- package/docs/en/intlayer_with_svelte_kit.md +159 -0
- package/docs/en/intlayer_with_tanstack.md +160 -1
- package/docs/en/intlayer_with_vite+preact.md +159 -0
- package/docs/en/intlayer_with_vite+react.md +159 -0
- package/docs/en/intlayer_with_vite+solid.md +148 -27
- package/docs/en/intlayer_with_vite+svelte.md +159 -0
- package/docs/en/intlayer_with_vite+vue.md +142 -41
- package/docs/en-GB/compiler.md +66 -34
- package/docs/en-GB/configuration.md +78 -36
- package/docs/es/compiler.md +83 -48
- package/docs/es/configuration.md +429 -206
- package/docs/es/intlayer_with_adonisjs.md +1 -1
- package/docs/es/intlayer_with_express.md +1 -1
- package/docs/es/intlayer_with_fastify.md +1 -1
- package/docs/es/intlayer_with_hono.md +1 -1
- package/docs/es/intlayer_with_nestjs.md +1 -1
- package/docs/es/intlayer_with_nextjs_16.md +176 -3
- package/docs/es/intlayer_with_nextjs_compiler.md +175 -2
- package/docs/es/intlayer_with_nuxt.md +1 -1
- package/docs/es/intlayer_with_react_router_v7.md +227 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +162 -4
- package/docs/es/intlayer_with_svelte_kit.md +158 -2
- package/docs/es/intlayer_with_tanstack.md +160 -2
- package/docs/es/intlayer_with_vite+preact.md +162 -6
- package/docs/es/intlayer_with_vite+react.md +160 -4
- package/docs/es/intlayer_with_vite+solid.md +163 -7
- package/docs/es/intlayer_with_vite+svelte.md +157 -1
- package/docs/es/intlayer_with_vite+vue.md +165 -9
- package/docs/fr/compiler.md +81 -46
- package/docs/fr/configuration.md +355 -134
- package/docs/fr/intlayer_with_adonisjs.md +1 -1
- package/docs/fr/intlayer_with_express.md +1 -1
- package/docs/fr/intlayer_with_fastify.md +1 -1
- package/docs/fr/intlayer_with_hono.md +1 -1
- package/docs/fr/intlayer_with_nestjs.md +1 -1
- package/docs/fr/intlayer_with_nextjs_16.md +183 -7
- package/docs/fr/intlayer_with_nextjs_compiler.md +179 -3
- package/docs/fr/intlayer_with_react_router_v7.md +229 -3
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +237 -6
- package/docs/fr/intlayer_with_svelte_kit.md +158 -2
- package/docs/fr/intlayer_with_tanstack.md +159 -1
- package/docs/fr/intlayer_with_vite+preact.md +164 -8
- package/docs/fr/intlayer_with_vite+react.md +162 -6
- package/docs/fr/intlayer_with_vite+solid.md +163 -7
- package/docs/fr/intlayer_with_vite+svelte.md +157 -1
- package/docs/fr/intlayer_with_vite+vue.md +164 -8
- package/docs/hi/compiler.md +81 -46
- package/docs/hi/configuration.md +87 -44
- package/docs/hi/intlayer_with_nextjs_16.md +174 -1
- package/docs/hi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/hi/intlayer_with_react_router_v7.md +224 -1
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/hi/intlayer_with_svelte_kit.md +158 -2
- package/docs/hi/intlayer_with_tanstack.md +159 -1
- package/docs/hi/intlayer_with_vite+preact.md +157 -1
- package/docs/hi/intlayer_with_vite+react.md +157 -1
- package/docs/hi/intlayer_with_vite+solid.md +157 -1
- package/docs/hi/intlayer_with_vite+svelte.md +157 -1
- package/docs/hi/intlayer_with_vite+vue.md +157 -1
- package/docs/id/compiler.md +84 -51
- package/docs/id/configuration.md +83 -45
- package/docs/id/intlayer_with_nextjs_16.md +174 -1
- package/docs/id/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/id/intlayer_with_react_router_v7.md +224 -1
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/id/intlayer_with_svelte_kit.md +158 -2
- package/docs/id/intlayer_with_tanstack.md +159 -1
- package/docs/id/intlayer_with_vite+preact.md +157 -1
- package/docs/id/intlayer_with_vite+react.md +157 -1
- package/docs/id/intlayer_with_vite+solid.md +157 -1
- package/docs/id/intlayer_with_vite+svelte.md +157 -1
- package/docs/id/intlayer_with_vite+vue.md +157 -1
- package/docs/it/compiler.md +81 -46
- package/docs/it/configuration.md +426 -204
- package/docs/it/intlayer_with_nextjs_16.md +174 -1
- package/docs/it/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/it/intlayer_with_react_router_v7.md +225 -2
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/it/intlayer_with_svelte_kit.md +158 -2
- package/docs/it/intlayer_with_tanstack.md +159 -1
- package/docs/it/intlayer_with_vite+preact.md +157 -1
- package/docs/it/intlayer_with_vite+react.md +157 -1
- package/docs/it/intlayer_with_vite+solid.md +159 -3
- package/docs/it/intlayer_with_vite+svelte.md +157 -1
- package/docs/it/intlayer_with_vite+vue.md +157 -1
- package/docs/ja/compiler.md +94 -58
- package/docs/ja/configuration.md +88 -45
- package/docs/ja/intlayer_with_nextjs_16.md +174 -1
- package/docs/ja/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ja/intlayer_with_react_router_v7.md +184 -394
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ja/intlayer_with_svelte_kit.md +119 -595
- package/docs/ja/intlayer_with_tanstack.md +131 -642
- package/docs/ja/intlayer_with_vite+preact.md +111 -1231
- package/docs/ja/intlayer_with_vite+react.md +129 -1304
- package/docs/ja/intlayer_with_vite+solid.md +159 -3
- package/docs/ja/intlayer_with_vite+svelte.md +157 -1
- package/docs/ja/intlayer_with_vite+vue.md +157 -1
- package/docs/ko/compiler.md +88 -52
- package/docs/ko/configuration.md +87 -44
- package/docs/ko/intlayer_with_nextjs_16.md +174 -1
- package/docs/ko/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ko/intlayer_with_react_router_v7.md +225 -2
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +226 -2
- package/docs/ko/intlayer_with_svelte_kit.md +158 -2
- package/docs/ko/intlayer_with_tanstack.md +159 -1
- package/docs/ko/intlayer_with_vite+preact.md +157 -1
- package/docs/ko/intlayer_with_vite+react.md +157 -1
- package/docs/ko/intlayer_with_vite+solid.md +159 -3
- package/docs/ko/intlayer_with_vite+svelte.md +157 -1
- package/docs/ko/intlayer_with_vite+vue.md +157 -1
- package/docs/pl/compiler.md +84 -51
- package/docs/pl/configuration.md +83 -37
- package/docs/pl/intlayer_with_nextjs_16.md +174 -1
- package/docs/pl/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pl/intlayer_with_react_router_v7.md +224 -1
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pl/intlayer_with_svelte_kit.md +158 -2
- package/docs/pl/intlayer_with_tanstack.md +159 -1
- package/docs/pl/intlayer_with_vite+preact.md +157 -1
- package/docs/pl/intlayer_with_vite+react.md +157 -1
- package/docs/pl/intlayer_with_vite+solid.md +157 -1
- package/docs/pl/intlayer_with_vite+svelte.md +157 -1
- package/docs/pl/intlayer_with_vite+vue.md +157 -1
- package/docs/pt/compiler.md +81 -46
- package/docs/pt/configuration.md +404 -194
- package/docs/pt/intlayer_with_nextjs_16.md +174 -1
- package/docs/pt/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/pt/intlayer_with_react_router_v7.md +224 -1
- package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/pt/intlayer_with_svelte_kit.md +158 -2
- package/docs/pt/intlayer_with_tanstack.md +159 -1
- package/docs/pt/intlayer_with_vite+preact.md +157 -1
- package/docs/pt/intlayer_with_vite+react.md +157 -1
- package/docs/pt/intlayer_with_vite+solid.md +157 -1
- package/docs/pt/intlayer_with_vite+svelte.md +157 -1
- package/docs/pt/intlayer_with_vite+vue.md +157 -1
- package/docs/ru/compiler.md +90 -57
- package/docs/ru/configuration.md +76 -46
- package/docs/ru/intlayer_with_nextjs_16.md +174 -1
- package/docs/ru/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/ru/intlayer_with_react_router_v7.md +224 -1
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/ru/intlayer_with_svelte_kit.md +158 -2
- package/docs/ru/intlayer_with_tanstack.md +159 -1
- package/docs/ru/intlayer_with_vite+preact.md +157 -1
- package/docs/ru/intlayer_with_vite+react.md +157 -1
- package/docs/ru/intlayer_with_vite+solid.md +157 -1
- package/docs/ru/intlayer_with_vite+svelte.md +157 -1
- package/docs/ru/intlayer_with_vite+vue.md +157 -1
- package/docs/tr/compiler.md +85 -52
- package/docs/tr/configuration.md +83 -40
- package/docs/tr/intlayer_with_nextjs_16.md +174 -1
- package/docs/tr/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/tr/intlayer_with_react_router_v7.md +224 -1
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/tr/intlayer_with_svelte_kit.md +158 -2
- package/docs/tr/intlayer_with_tanstack.md +159 -1
- package/docs/tr/intlayer_with_vite+preact.md +157 -1
- package/docs/tr/intlayer_with_vite+react.md +157 -1
- package/docs/tr/intlayer_with_vite+solid.md +157 -1
- package/docs/tr/intlayer_with_vite+svelte.md +157 -1
- package/docs/tr/intlayer_with_vite+vue.md +157 -1
- package/docs/uk/compiler.md +96 -61
- package/docs/uk/configuration.md +83 -37
- package/docs/uk/intlayer_with_nextjs_16.md +174 -1
- package/docs/uk/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/uk/intlayer_with_react_router_v7.md +224 -1
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/uk/intlayer_with_svelte_kit.md +157 -1
- package/docs/uk/intlayer_with_tanstack.md +159 -1
- package/docs/uk/intlayer_with_vite+preact.md +157 -1
- package/docs/uk/intlayer_with_vite+react.md +157 -1
- package/docs/uk/intlayer_with_vite+solid.md +157 -1
- package/docs/uk/intlayer_with_vite+svelte.md +157 -1
- package/docs/uk/intlayer_with_vite+vue.md +157 -1
- package/docs/vi/compiler.md +85 -50
- package/docs/vi/configuration.md +85 -39
- package/docs/vi/intlayer_with_nextjs_16.md +174 -1
- package/docs/vi/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/vi/intlayer_with_react_router_v7.md +224 -1
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +225 -1
- package/docs/vi/intlayer_with_svelte_kit.md +158 -2
- package/docs/vi/intlayer_with_tanstack.md +159 -1
- package/docs/vi/intlayer_with_vite+preact.md +157 -1
- package/docs/vi/intlayer_with_vite+react.md +157 -1
- package/docs/vi/intlayer_with_vite+solid.md +157 -1
- package/docs/vi/intlayer_with_vite+svelte.md +157 -1
- package/docs/vi/intlayer_with_vite+vue.md +157 -1
- package/docs/zh/compiler.md +84 -49
- package/docs/zh/configuration.md +80 -37
- package/docs/zh/intlayer_with_adonisjs.md +1 -1
- package/docs/zh/intlayer_with_express.md +1 -1
- package/docs/zh/intlayer_with_fastify.md +1 -1
- package/docs/zh/intlayer_with_hono.md +1 -1
- package/docs/zh/intlayer_with_nestjs.md +1 -1
- package/docs/zh/intlayer_with_nextjs_16.md +174 -1
- package/docs/zh/intlayer_with_nextjs_compiler.md +174 -1
- package/docs/zh/intlayer_with_react_router_v7.md +227 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +228 -4
- package/docs/zh/intlayer_with_svelte_kit.md +158 -2
- package/docs/zh/intlayer_with_tanstack.md +159 -1
- package/docs/zh/intlayer_with_vite+preact.md +159 -3
- package/docs/zh/intlayer_with_vite+react.md +157 -1
- package/docs/zh/intlayer_with_vite+solid.md +161 -5
- package/docs/zh/intlayer_with_vite+svelte.md +157 -1
- package/docs/zh/intlayer_with_vite+vue.md +158 -2
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-04
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: React Router v7 i18n - Comment traduire une application React Router v7 en 2026
|
|
5
5
|
description: Apprenez à ajouter l'internationalisation (i18n) à votre application React Router v7 en utilisant Intlayer. Suivez ce guide complet pour rendre votre application multilingue avec un routage sensible à la locale.
|
|
6
6
|
keywords:
|
|
@@ -101,7 +101,7 @@ bunx intlayer init
|
|
|
101
101
|
## Guide étape par étape pour configurer Intlayer dans une application React Router v7 avec des routes basées sur le système de fichiers
|
|
102
102
|
|
|
103
103
|
<Tabs defaultTab="video">
|
|
104
|
-
<Tab label="
|
|
104
|
+
<Tab label="Vidéo" value="video">
|
|
105
105
|
|
|
106
106
|
<iframe title="How to translate an React Router v7 app using Intlayer" class="m-auto aspect-16/9 w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
107
107
|
|
|
@@ -111,7 +111,7 @@ bunx intlayer init
|
|
|
111
111
|
<iframe
|
|
112
112
|
src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
113
113
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
114
|
-
title="
|
|
114
|
+
title="Démo CodeSandbox - Comment internationaliser votre application avec Intlayer"
|
|
115
115
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
116
116
|
loading="lazy"
|
|
117
117
|
/>
|
|
@@ -507,6 +507,232 @@ export default function RootLayout() {
|
|
|
507
507
|
}
|
|
508
508
|
```
|
|
509
509
|
|
|
510
|
+
### (Optionnel) Étape 12 : Extraire le contenu de vos composants
|
|
511
|
+
|
|
512
|
+
Si vous avez une base de code existante, transformer des milliers de fichiers peut prendre beaucoup de temps.
|
|
513
|
+
|
|
514
|
+
Pour faciliter ce processus, Intlayer propose un [compilateur](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/compiler.md) / [extracteur](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/extract.md) pour transformer vos composants et extraire le contenu.
|
|
515
|
+
|
|
516
|
+
Pour le configurer, vous pouvez ajouter une section `compiler` dans votre fichier `intlayer.config.ts` :
|
|
517
|
+
|
|
518
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
519
|
+
import { type IntlayerConfig } from "intlayer";
|
|
520
|
+
|
|
521
|
+
const config: IntlayerConfig = {
|
|
522
|
+
// ... Reste de votre configuration
|
|
523
|
+
compiler: {
|
|
524
|
+
/**
|
|
525
|
+
* Indique si le compilateur doit être activé.
|
|
526
|
+
*/
|
|
527
|
+
enabled: true,
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Définit le chemin des fichiers de sortie
|
|
531
|
+
*/
|
|
532
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
536
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
537
|
+
*/
|
|
538
|
+
saveComponents: false,
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Préfixe de clé de dictionnaire
|
|
542
|
+
*/
|
|
543
|
+
dictionaryKeyPrefix: "",
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
export default config;
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
551
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
552
|
+
const config = {
|
|
553
|
+
// ... Reste de votre configuration
|
|
554
|
+
compiler: {
|
|
555
|
+
/**
|
|
556
|
+
* Indique si le compilateur doit être activé.
|
|
557
|
+
*/
|
|
558
|
+
enabled: true,
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Définit le chemin des fichiers de sortie
|
|
562
|
+
*/
|
|
563
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
567
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
568
|
+
*/
|
|
569
|
+
saveComponents: false,
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Préfixe de clé de dictionnaire
|
|
573
|
+
*/
|
|
574
|
+
dictionaryKeyPrefix: "",
|
|
575
|
+
},
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
export default config;
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
582
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
583
|
+
const config = {
|
|
584
|
+
// ... Reste de votre configuration
|
|
585
|
+
compiler: {
|
|
586
|
+
/**
|
|
587
|
+
* Indique si le compilateur doit être activé.
|
|
588
|
+
*/
|
|
589
|
+
enabled: true,
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Définit le chemin des fichiers de sortie
|
|
593
|
+
*/
|
|
594
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
598
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
599
|
+
*/
|
|
600
|
+
saveComponents: false,
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Préfixe de clé de dictionnaire
|
|
604
|
+
*/
|
|
605
|
+
dictionaryKeyPrefix: "",
|
|
606
|
+
},
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
module.exports = config;
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
<Tabs>
|
|
613
|
+
<Tab value='Commande d'extraction'>
|
|
614
|
+
|
|
615
|
+
Exécutez l'extracteur pour transformer vos composants et extraire le contenu
|
|
616
|
+
|
|
617
|
+
```bash packageManager="npm"
|
|
618
|
+
npx intlayer extract
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
```bash packageManager="pnpm"
|
|
622
|
+
pnpm intlayer extract
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
```bash packageManager="yarn"
|
|
626
|
+
yarn intlayer extract
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
```bash packageManager="bun"
|
|
630
|
+
bunx intlayer extract
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
</Tab>
|
|
634
|
+
<Tab value='Compilateur Babel'>
|
|
635
|
+
|
|
636
|
+
Mettez à jour votre fichier `vite.config.ts` pour inclure le plugin `intlayerCompiler` :
|
|
637
|
+
|
|
638
|
+
```ts fileName="vite.config.ts"
|
|
639
|
+
import { defineConfig } from "vite";
|
|
640
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
641
|
+
|
|
642
|
+
export default defineConfig({
|
|
643
|
+
plugins: [
|
|
644
|
+
intlayer(),
|
|
645
|
+
intlayerCompiler(), // Ajoute le plugin du compilateur
|
|
646
|
+
],
|
|
647
|
+
});
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
```bash packageManager="npm"
|
|
651
|
+
npm run build # Ou npm run dev
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
```bash packageManager="pnpm"
|
|
655
|
+
pnpm run build # Ou pnpm run dev
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
```bash packageManager="yarn"
|
|
659
|
+
yarn build # Ou yarn dev
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
```bash packageManager="bun"
|
|
663
|
+
bun run build # Or bun run dev
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
</Tab>
|
|
667
|
+
</Tabs>
|
|
668
|
+
|
|
669
|
+
---
|
|
670
|
+
|
|
671
|
+
## Configure TypeScript
|
|
672
|
+
|
|
673
|
+
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
674
|
+
|
|
675
|
+
Ensure your TypeScript configuration includes the autogenerated types:
|
|
676
|
+
|
|
677
|
+
```json5 fileName="tsconfig.json"
|
|
678
|
+
{
|
|
679
|
+
// ... your existing configurations
|
|
680
|
+
include: [
|
|
681
|
+
// ... your existing includes
|
|
682
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
683
|
+
],
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## Git Configuration
|
|
690
|
+
|
|
691
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
692
|
+
|
|
693
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
694
|
+
|
|
695
|
+
```plaintext fileName=".gitignore"
|
|
696
|
+
# Ignorer les fichiers générés par Intlayer
|
|
697
|
+
.intlayer
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## VS Code Extension
|
|
703
|
+
|
|
704
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
705
|
+
|
|
706
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
707
|
+
|
|
708
|
+
This extension provides:
|
|
709
|
+
|
|
710
|
+
- **Autocompletion** for translation keys.
|
|
711
|
+
- **Real-time error detection** for missing translations.
|
|
712
|
+
- **Inline previews** of translated content.
|
|
713
|
+
- **Quick actions** to easily create and update translations.
|
|
714
|
+
|
|
715
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
## Go Further
|
|
720
|
+
|
|
721
|
+
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).
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Documentation References
|
|
726
|
+
|
|
727
|
+
- [Intlayer Documentation](https://intlayer.org)
|
|
728
|
+
- [React Router v7 Documentation](https://reactrouter.com/)
|
|
729
|
+
- [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useIntlayer.md)
|
|
730
|
+
- [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/packages/react-intlayer/useLocale.md)
|
|
731
|
+
- [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
732
|
+
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
|
|
733
|
+
|
|
734
|
+
This comprehensive guide provides everything you need to integrate Intlayer with React Router v7 for a fully internationalized application with locale-aware routing and TypeScript support.
|
|
735
|
+
|
|
510
736
|
### Étape 11 : Ajouter un middleware (Optionnel)
|
|
511
737
|
|
|
512
738
|
Vous pouvez également utiliser le `intlayerProxy` pour ajouter un routage côté serveur à votre application. Ce plugin détectera automatiquement la locale actuelle en fonction de l'URL et définira le cookie de locale approprié. Si aucune locale n'est spécifiée, le plugin déterminera la locale la plus appropriée en fonction des préférences linguistiques du navigateur de l'utilisateur. Si aucune locale n'est détectée, il redirigera vers la locale par défaut.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-12-07
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-03-12
|
|
4
4
|
title: React Router v7 i18n - Comment traduire une application React Router v7 en 2026
|
|
5
5
|
description: Apprenez à ajouter l'internationalisation (i18n) à votre application React Router v7 en utilisant Intlayer avec un routage basé sur le système de fichiers. Suivez ce guide complet pour rendre votre application multilingue avec un routage sensible à la locale.
|
|
6
6
|
keywords:
|
|
@@ -36,7 +36,7 @@ Ce guide montre comment intégrer **Intlayer** pour une internationalisation flu
|
|
|
36
36
|
|
|
37
37
|
Pour le routage côté client, consultez le guide [Intlayer avec React Router v7](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_with_react_router_v7.md).
|
|
38
38
|
|
|
39
|
-
## Table
|
|
39
|
+
## Table des matières
|
|
40
40
|
|
|
41
41
|
<TOC/>
|
|
42
42
|
|
|
@@ -57,9 +57,9 @@ Avec Intlayer, vous pouvez :
|
|
|
57
57
|
## Guide étape par étape pour configurer Intlayer dans une application React Router v7 avec des routes basées sur le système de fichiers
|
|
58
58
|
|
|
59
59
|
<Tabs defaultTab="video">
|
|
60
|
-
<Tab label="
|
|
60
|
+
<Tab label="Vidéo" value="video">
|
|
61
61
|
|
|
62
|
-
<iframe title="
|
|
62
|
+
<iframe title="Comment traduire une application React Router v7 (File-System Routes) avec Intlayer" class="m-auto aspect-16/9 w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
63
63
|
|
|
64
64
|
</Tab>
|
|
65
65
|
<Tab label="Code" value="code">
|
|
@@ -67,7 +67,7 @@ Avec Intlayer, vous pouvez :
|
|
|
67
67
|
<iframe
|
|
68
68
|
src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-fs-routes-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
69
69
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
70
|
-
title="
|
|
70
|
+
title="Démo CodeSandbox - Comment internationaliser votre application avec Intlayer"
|
|
71
71
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
72
72
|
loading="lazy"
|
|
73
73
|
/>
|
|
@@ -75,7 +75,7 @@ Avec Intlayer, vous pouvez :
|
|
|
75
75
|
</Tab>
|
|
76
76
|
</Tabs>
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Voir le [Modèle d'Application](https://github.com/aymericzip/intlayer-react-router-v7-fs-routes-template) sur GitHub.
|
|
79
79
|
|
|
80
80
|
### Étape 1 : Installer les dépendances
|
|
81
81
|
|
|
@@ -576,6 +576,237 @@ export const useI18nHTMLAttributes = () => {
|
|
|
576
576
|
|
|
577
577
|
Ce hook est déjà utilisé dans le composant de mise en page (`root.tsx`) montré à l'Étape 5.
|
|
578
578
|
|
|
579
|
+
### (Optionnel) Étape 11 : Extraire le contenu de vos composants
|
|
580
|
+
|
|
581
|
+
Si vous avez une base de code existante, transformer des milliers de fichiers peut prendre beaucoup de temps.
|
|
582
|
+
|
|
583
|
+
Pour faciliter ce processus, Intlayer propose un [compilateur](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/compiler.md) / [extracteur](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/extract.md) pour transformer vos composants et extraire le contenu.
|
|
584
|
+
|
|
585
|
+
Pour le configurer, vous pouvez ajouter une section `compiler` dans votre fichier `intlayer.config.ts` :
|
|
586
|
+
|
|
587
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
588
|
+
import { type IntlayerConfig } from "intlayer";
|
|
589
|
+
|
|
590
|
+
const config: IntlayerConfig = {
|
|
591
|
+
// ... Reste de votre configuration
|
|
592
|
+
compiler: {
|
|
593
|
+
/**
|
|
594
|
+
* Indique si le compilateur doit être activé.
|
|
595
|
+
*/
|
|
596
|
+
enabled: true,
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Définit le chemin des fichiers de sortie
|
|
600
|
+
*/
|
|
601
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
605
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
606
|
+
*/
|
|
607
|
+
saveComponents: false,
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Préfixe de clé de dictionnaire
|
|
611
|
+
*/
|
|
612
|
+
dictionaryKeyPrefix: "",
|
|
613
|
+
},
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
export default config;
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
620
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
621
|
+
const config = {
|
|
622
|
+
// ... Reste de votre configuration
|
|
623
|
+
compiler: {
|
|
624
|
+
/**
|
|
625
|
+
* Indique si le compilateur doit être activé.
|
|
626
|
+
*/
|
|
627
|
+
enabled: true,
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Définit le chemin des fichiers de sortie
|
|
631
|
+
*/
|
|
632
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
636
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
637
|
+
*/
|
|
638
|
+
saveComponents: false,
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Préfixe de clé de dictionnaire
|
|
642
|
+
*/
|
|
643
|
+
dictionaryKeyPrefix: "",
|
|
644
|
+
},
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
export default config;
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
651
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
652
|
+
const config = {
|
|
653
|
+
// ... Reste de votre configuration
|
|
654
|
+
compiler: {
|
|
655
|
+
/**
|
|
656
|
+
* Indique si le compilateur doit être activé.
|
|
657
|
+
*/
|
|
658
|
+
enabled: true,
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Définit le chemin des fichiers de sortie
|
|
662
|
+
*/
|
|
663
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Indique si les composants doivent être sauvegardés après avoir été transformés.
|
|
667
|
+
* De cette façon, le compilateur peut être exécuté une seule fois pour transformer l'application, puis il peut être supprimé.
|
|
668
|
+
*/
|
|
669
|
+
saveComponents: false,
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Préfixe de clé de dictionnaire
|
|
673
|
+
*/
|
|
674
|
+
dictionaryKeyPrefix: "",
|
|
675
|
+
},
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
module.exports = config;
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
<Tabs>
|
|
682
|
+
<Tab value='Commande d'extraction'>
|
|
683
|
+
|
|
684
|
+
Exécutez l'extracteur pour transformer vos composants et extraire le contenu
|
|
685
|
+
|
|
686
|
+
```bash packageManager="npm"
|
|
687
|
+
npx intlayer extract
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
```bash packageManager="pnpm"
|
|
691
|
+
pnpm intlayer extract
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
```bash packageManager="yarn"
|
|
695
|
+
yarn intlayer extract
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
```bash packageManager="bun"
|
|
699
|
+
bunx intlayer extract
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
</Tab>
|
|
703
|
+
<Tab value='Compilateur Babel'>
|
|
704
|
+
|
|
705
|
+
Mettez à jour votre fichier `vite.config.ts` pour inclure le plugin `intlayerCompiler` :
|
|
706
|
+
|
|
707
|
+
```ts fileName="vite.config.ts"
|
|
708
|
+
import { defineConfig } from "vite";
|
|
709
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
710
|
+
|
|
711
|
+
export default defineConfig({
|
|
712
|
+
plugins: [
|
|
713
|
+
intlayer(),
|
|
714
|
+
intlayerCompiler(), // Ajoute le plugin du compilateur
|
|
715
|
+
],
|
|
716
|
+
});
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
```bash packageManager="npm"
|
|
720
|
+
npm run build # Ou npm run dev
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
```bash packageManager="pnpm"
|
|
724
|
+
pnpm run build # Ou pnpm run dev
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
```bash packageManager="yarn"
|
|
728
|
+
yarn build # Ou yarn dev
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
```bash packageManager="bun"
|
|
732
|
+
bun run build # Ou bun run dev
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
</Tab>
|
|
736
|
+
</Tabs>
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
## Configurer TypeScript
|
|
741
|
+
|
|
742
|
+
Intlayer utilise l'augmentation de module pour tirer parti des avantages de TypeScript et renforcer votre base de code.
|
|
743
|
+
|
|
744
|
+

|
|
745
|
+
|
|
746
|
+

|
|
747
|
+
|
|
748
|
+
Assurez-vous que votre configuration TypeScript inclut les types générés automatiquement :
|
|
749
|
+
|
|
750
|
+
```json5 fileName="tsconfig.json"
|
|
751
|
+
{
|
|
752
|
+
// ... vos configurations existantes
|
|
753
|
+
include: [
|
|
754
|
+
// ... vos configurations existantes
|
|
755
|
+
".intlayer/**/*.ts", // Inclure les types générés automatiquement
|
|
756
|
+
],
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
---
|
|
761
|
+
|
|
762
|
+
## Configuration de Git
|
|
763
|
+
|
|
764
|
+
Il est recommandé d'ignorer les fichiers générés par Intlayer. Cela vous permet d'éviter de les committer dans votre dépôt Git.
|
|
765
|
+
|
|
766
|
+
Pour ce faire, vous pouvez ajouter les instructions suivantes à votre fichier `.gitignore` :
|
|
767
|
+
|
|
768
|
+
```plaintext fileName=".gitignore"
|
|
769
|
+
# Ignorer les fichiers générés par Intlayer
|
|
770
|
+
.intlayer
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
---
|
|
774
|
+
|
|
775
|
+
## Extension VS Code
|
|
776
|
+
|
|
777
|
+
Pour améliorer votre expérience de développement avec Intlayer, vous pouvez installer l'extension officielle **Intlayer VS Code Extension**.
|
|
778
|
+
|
|
779
|
+
[Installer depuis le Marketplace VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
780
|
+
|
|
781
|
+
Cette extension fournit :
|
|
782
|
+
|
|
783
|
+
- **L'autocomplétion** pour les clés de traduction.
|
|
784
|
+
- **La détection des erreurs en temps réel** pour les traductions manquantes.
|
|
785
|
+
- **Des aperçus en ligne** du contenu traduit.
|
|
786
|
+
- **Des actions rapides** pour faciliter la création et la mise à jour des traductions.
|
|
787
|
+
|
|
788
|
+
Pour plus de détails sur l'utilisation de l'extension, reportez-vous à la [documentation de l'extension Intlayer pour VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## Aller plus loin
|
|
793
|
+
|
|
794
|
+
Pour aller plus loin, vous pouvez implémenter l'[éditeur visuel](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_visual_editor.md) ou externaliser votre contenu en utilisant le [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_CMS.md).
|
|
795
|
+
|
|
796
|
+
---
|
|
797
|
+
|
|
798
|
+
## Références de Documentation
|
|
799
|
+
|
|
800
|
+
- [Documentation Intlayer](https://intlayer.org)
|
|
801
|
+
- [Documentation React Router v7](https://reactrouter.com/)
|
|
802
|
+
- [Documentation React Router fs-routes](https://reactrouter.com/how-to/file-route-conventions)
|
|
803
|
+
- [Hook useIntlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useIntlayer.md)
|
|
804
|
+
- [Hook useLocale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useLocale.md)
|
|
805
|
+
- [Déclaration de contenu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/content_file.md)
|
|
806
|
+
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/configuration.md)
|
|
807
|
+
|
|
808
|
+
Ce guide complet vous fournit tout ce dont vous avez besoin pour intégrer Intlayer avec React Router v7 en utilisant un routage basé sur le système de fichiers pour obtenir une application entièrement internationalisée avec un routage sensible à la locale et une prise en charge de TypeScript.
|
|
809
|
+
|
|
579
810
|
### Étape 10 : Ajouter un middleware (Optionnel)
|
|
580
811
|
|
|
581
812
|
Vous pouvez également utiliser le `intlayerProxy` pour ajouter un routage côté serveur à votre application. Ce plugin détectera automatiquement la locale actuelle en fonction de l'URL et définira le cookie de locale approprié. Si aucune locale n'est spécifiée, le plugin déterminera la locale la plus appropriée en fonction des préférences linguistiques du navigateur de l'utilisateur. Si aucune locale n'est détectée, il redirigera vers la locale par défaut.
|