@intlayer/docs 6.1.6-canary.0 → 6.1.6
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/en/next-i18next_vs_next-intl_vs_intlayer.md +71 -80
- package/dist/cjs/generated/docs.entry.cjs +16 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +16 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +13 -4
- package/docs/en/intlayer_with_nextjs_15.md +13 -4
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/package.json +11 -11
- package/src/generated/docs.entry.ts +16 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-09-04
|
|
3
|
-
updatedAt: 2025-
|
|
4
|
-
title: Prise en main
|
|
5
|
-
description: Apprenez
|
|
3
|
+
updatedAt: 2025-10-03
|
|
4
|
+
title: Prise en main de l'internationalisation avec Intlayer dans React Router v7
|
|
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:
|
|
7
7
|
- Internationalisation
|
|
8
8
|
- Documentation
|
|
@@ -17,25 +17,24 @@ slugs:
|
|
|
17
17
|
- environment
|
|
18
18
|
- vite-and-react
|
|
19
19
|
- react-router-v7
|
|
20
|
-
applicationTemplate: https://github.com/
|
|
21
|
-
author: AydinTheFirst
|
|
20
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-react-router-v7-template
|
|
22
21
|
---
|
|
23
22
|
|
|
24
23
|
# Prise en main de l'internationalisation (i18n) avec Intlayer et React Router v7
|
|
25
24
|
|
|
26
|
-
Ce guide montre comment intégrer **Intlayer** pour une internationalisation fluide dans les projets React Router v7 avec un routage sensible à la locale, la prise en charge de TypeScript et des pratiques de développement modernes.
|
|
25
|
+
Ce guide montre comment intégrer **Intlayer** pour une internationalisation fluide dans les projets React Router v7 avec un routage sensible à la locale, la prise en charge de TypeScript, et des pratiques de développement modernes.
|
|
27
26
|
|
|
28
|
-
## Qu'est-ce
|
|
27
|
+
## Qu'est-ce que Intlayer ?
|
|
29
28
|
|
|
30
|
-
**Intlayer** est une bibliothèque d'internationalisation (i18n) innovante et open-source conçue pour simplifier la prise en charge multilingue dans les applications web modernes.
|
|
29
|
+
**Intlayer** est une bibliothèque d'internationalisation (i18n) innovante et open-source, conçue pour simplifier la prise en charge multilingue dans les applications web modernes.
|
|
31
30
|
|
|
32
31
|
Avec Intlayer, vous pouvez :
|
|
33
32
|
|
|
34
33
|
- **Gérer facilement les traductions** en utilisant des dictionnaires déclaratifs au niveau des composants.
|
|
35
34
|
- **Localiser dynamiquement les métadonnées**, les routes et le contenu.
|
|
36
|
-
- **Assurer la prise en charge de TypeScript** avec des types générés automatiquement, améliorant l'autocomplétion et la détection
|
|
35
|
+
- **Assurer la prise en charge de TypeScript** avec des types générés automatiquement, améliorant l'autocomplétion et la détection d'erreurs.
|
|
37
36
|
- **Bénéficier de fonctionnalités avancées**, comme la détection et le changement dynamique de la locale.
|
|
38
|
-
- **Activer
|
|
37
|
+
- **Activer un routage sensible à la locale** avec le système de routage basé sur la configuration de React Router v7.
|
|
39
38
|
|
|
40
39
|
---
|
|
41
40
|
|
|
@@ -59,13 +58,13 @@ pnpm add vite-intlayer --save-dev
|
|
|
59
58
|
|
|
60
59
|
- **intlayer**
|
|
61
60
|
|
|
62
|
-
Le
|
|
61
|
+
Le package principal qui fournit des outils d'internationalisation pour la gestion de la configuration, la traduction, la [déclaration de contenu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/get_started.md), la transpilation, et les [commandes CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_cli.md).
|
|
63
62
|
|
|
64
63
|
- **react-intlayer**
|
|
65
|
-
Le
|
|
64
|
+
Le package qui intègre Intlayer avec une application React. Il fournit des fournisseurs de contexte et des hooks pour l'internationalisation dans React.
|
|
66
65
|
|
|
67
66
|
- **vite-intlayer**
|
|
68
|
-
|
|
67
|
+
Comprend le plugin Vite pour intégrer Intlayer avec le [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), ainsi que des middlewares pour détecter la locale préférée de l'utilisateur, gérer les cookies, et gérer la redirection des URL.
|
|
69
68
|
|
|
70
69
|
### Étape 2 : Configuration de votre projet
|
|
71
70
|
|
|
@@ -77,10 +76,7 @@ import { type IntlayerConfig, Locales } from "intlayer";
|
|
|
77
76
|
const config: IntlayerConfig = {
|
|
78
77
|
internationalization: {
|
|
79
78
|
defaultLocale: Locales.ENGLISH,
|
|
80
|
-
locales: [Locales.ENGLISH, Locales.
|
|
81
|
-
},
|
|
82
|
-
middleware: {
|
|
83
|
-
prefixDefault: true, // Toujours préfixer la locale par défaut dans les URLs
|
|
79
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
84
80
|
},
|
|
85
81
|
};
|
|
86
82
|
|
|
@@ -94,10 +90,7 @@ import { Locales } from "intlayer";
|
|
|
94
90
|
const config = {
|
|
95
91
|
internationalization: {
|
|
96
92
|
defaultLocale: Locales.ENGLISH,
|
|
97
|
-
locales: [Locales.ENGLISH, Locales.
|
|
98
|
-
},
|
|
99
|
-
middleware: {
|
|
100
|
-
prefixDefault: true,
|
|
93
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
101
94
|
},
|
|
102
95
|
};
|
|
103
96
|
|
|
@@ -108,96 +101,79 @@ export default config;
|
|
|
108
101
|
const { Locales } = require("intlayer");
|
|
109
102
|
|
|
110
103
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
104
|
+
// Configuration pour l'internationalisation
|
|
111
105
|
const config = {
|
|
112
106
|
internationalization: {
|
|
113
|
-
defaultLocale: Locales.ENGLISH,
|
|
114
|
-
locales: [Locales.ENGLISH, Locales.
|
|
115
|
-
},
|
|
116
|
-
middleware: {
|
|
117
|
-
prefixDefault: true,
|
|
107
|
+
defaultLocale: Locales.ENGLISH, // Langue par défaut
|
|
108
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH], // Langues supportées
|
|
118
109
|
},
|
|
119
110
|
};
|
|
120
111
|
|
|
121
112
|
module.exports = config;
|
|
122
113
|
```
|
|
123
114
|
|
|
124
|
-
> Grâce à ce fichier de configuration, vous pouvez configurer
|
|
125
|
-
|
|
126
|
-
### Étape 3 : Configurer les routes de React Router v7
|
|
127
|
-
|
|
128
|
-
Configurez votre routage avec des routes sensibles à la locale :
|
|
129
|
-
|
|
130
|
-
```typescript fileName="app/routes.ts" codeFormat="typescript"
|
|
131
|
-
import { layout, route, type RouteConfig } from "@react-router/dev/routes";
|
|
132
|
-
|
|
133
|
-
export default [
|
|
134
|
-
layout("routes/layout.tsx", [
|
|
135
|
-
route("/", "routes/page.tsx"), // Page racine - redirige vers la locale
|
|
136
|
-
route("/:lang", "routes/[lang]/page.tsx"), // Page d'accueil localisée
|
|
137
|
-
route("/:lang/about", "routes/[lang]/about/page.tsx"), // Page "à propos" localisée
|
|
138
|
-
]),
|
|
139
|
-
] satisfies RouteConfig;
|
|
140
|
-
```
|
|
115
|
+
> Grâce à ce fichier de configuration, vous pouvez configurer les URLs localisées, la redirection via middleware, les noms des cookies, l'emplacement et l'extension de vos déclarations de contenu, désactiver les logs Intlayer dans la console, et bien plus encore. Pour une liste complète des paramètres disponibles, consultez la [documentation de configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/configuration.md).
|
|
141
116
|
|
|
142
|
-
### Étape
|
|
117
|
+
### Étape 3 : Intégrer Intlayer dans votre configuration Vite
|
|
143
118
|
|
|
144
119
|
Ajoutez le plugin intlayer dans votre configuration :
|
|
145
120
|
|
|
146
|
-
```typescript fileName="vite.config.ts"
|
|
121
|
+
```typescript fileName="vite.config.ts"
|
|
147
122
|
import { reactRouter } from "@react-router/dev/vite";
|
|
148
123
|
import { defineConfig } from "vite";
|
|
149
|
-
import {
|
|
124
|
+
import { intlayer } from "vite-intlayer";
|
|
150
125
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
151
126
|
|
|
152
127
|
export default defineConfig({
|
|
153
|
-
plugins: [
|
|
154
|
-
reactRouter(),
|
|
155
|
-
tsconfigPaths(),
|
|
156
|
-
intlayer(),
|
|
157
|
-
intlayerMiddlewarePlugin(),
|
|
158
|
-
],
|
|
128
|
+
plugins: [reactRouter(), tsconfigPaths(), intlayer()],
|
|
159
129
|
});
|
|
160
130
|
```
|
|
161
131
|
|
|
162
132
|
> Le plugin Vite `intlayer()` est utilisé pour intégrer Intlayer avec Vite. Il assure la génération des fichiers de déclaration de contenu et les surveille en mode développement. Il définit les variables d'environnement Intlayer au sein de l'application Vite. De plus, il fournit des alias pour optimiser les performances.
|
|
163
133
|
|
|
134
|
+
### Étape 4 : Configurer les routes de React Router v7
|
|
135
|
+
|
|
136
|
+
Configurez votre routage avec des routes sensibles à la locale :
|
|
137
|
+
|
|
138
|
+
```typescript fileName="app/routes.ts"
|
|
139
|
+
import { layout, route, type RouteConfig } from "@react-router/dev/routes";
|
|
140
|
+
|
|
141
|
+
export default [
|
|
142
|
+
layout("routes/layout.tsx", [
|
|
143
|
+
route("/:lang?", "routes/page.tsx"), // Page d'accueil localisée
|
|
144
|
+
route("/:lang?/about", "routes/about/page.tsx"), // Page À propos localisée
|
|
145
|
+
]),
|
|
146
|
+
] satisfies RouteConfig;
|
|
147
|
+
```
|
|
148
|
+
|
|
164
149
|
### Étape 5 : Créer les composants de mise en page
|
|
165
150
|
|
|
166
151
|
Configurez votre mise en page racine et les mises en page spécifiques à la locale :
|
|
167
152
|
|
|
168
153
|
#### Mise en page racine
|
|
169
154
|
|
|
170
|
-
```tsx fileName="app/routes/layout.tsx"
|
|
171
|
-
// app/routes/layout.tsx
|
|
172
|
-
import { Outlet } from "react-router";
|
|
155
|
+
```tsx fileName="app/routes/layout.tsx"
|
|
173
156
|
import { IntlayerProvider } from "react-intlayer";
|
|
157
|
+
import { Outlet } from "react-router";
|
|
158
|
+
|
|
159
|
+
import type { Route } from "./+types/layout";
|
|
160
|
+
|
|
161
|
+
export default function RootLayout({ params }: Route.ComponentProps) {
|
|
162
|
+
const { locale } = params;
|
|
174
163
|
|
|
175
|
-
export default function RootLayout() {
|
|
176
164
|
return (
|
|
177
|
-
<IntlayerProvider>
|
|
165
|
+
<IntlayerProvider locale={locale}>
|
|
178
166
|
<Outlet />
|
|
179
167
|
</IntlayerProvider>
|
|
180
168
|
);
|
|
181
169
|
}
|
|
182
170
|
```
|
|
183
171
|
|
|
184
|
-
### Étape 6 : Déclarez
|
|
172
|
+
### Étape 6 : Déclarez votre contenu
|
|
185
173
|
|
|
186
174
|
Créez et gérez vos déclarations de contenu pour stocker les traductions :
|
|
187
175
|
|
|
188
|
-
```tsx fileName="app/routes/[lang]/page.content.ts"
|
|
189
|
-
import { t, type Dictionary } from "intlayer";
|
|
190
|
-
|
|
191
|
-
const pageContent = {
|
|
192
|
-
key: "page",
|
|
193
|
-
content: {
|
|
194
|
-
title: t({
|
|
195
|
-
en: "Welcome to React Router v7 + Intlayer",
|
|
196
|
-
tr: "React Router v7 + Intlayer'a Hoş Geldiniz",
|
|
197
|
-
}),
|
|
198
|
-
description: t({
|
|
199
|
-
en: "Build multilingual applications with ease using React Router v7 and Intlayer.",
|
|
200
|
-
tsx fileName="app/routes/[lang]/page.content.ts" contentDeclarationFormat="typescript"
|
|
176
|
+
```tsx fileName="app/routes/[lang]/page.content.ts"
|
|
201
177
|
import { t, type Dictionary } from "intlayer";
|
|
202
178
|
|
|
203
179
|
const pageContent = {
|
|
@@ -205,22 +181,22 @@ const pageContent = {
|
|
|
205
181
|
content: {
|
|
206
182
|
title: t({
|
|
207
183
|
en: "Welcome to React Router v7 + Intlayer",
|
|
208
|
-
|
|
184
|
+
es: "Bienvenido a React Router v7 + Intlayer",
|
|
209
185
|
fr: "Bienvenue sur React Router v7 + Intlayer",
|
|
210
186
|
}),
|
|
211
187
|
description: t({
|
|
212
188
|
en: "Build multilingual applications with ease using React Router v7 and Intlayer.",
|
|
213
|
-
|
|
189
|
+
es: "Cree aplicaciones multilingües fácilmente usando React Router v7 y Intlayer.",
|
|
214
190
|
fr: "Créez des applications multilingues facilement avec React Router v7 et Intlayer.",
|
|
215
191
|
}),
|
|
216
192
|
aboutLink: t({
|
|
217
193
|
en: "Learn About Us",
|
|
218
|
-
|
|
194
|
+
es: "Aprender Sobre Nosotros",
|
|
219
195
|
fr: "En savoir plus sur nous",
|
|
220
196
|
}),
|
|
221
197
|
homeLink: t({
|
|
222
198
|
en: "Home",
|
|
223
|
-
|
|
199
|
+
es: "Inicio",
|
|
224
200
|
fr: "Accueil",
|
|
225
201
|
}),
|
|
226
202
|
},
|
|
@@ -229,104 +205,92 @@ const pageContent = {
|
|
|
229
205
|
export default pageContent;
|
|
230
206
|
```
|
|
231
207
|
|
|
232
|
-
> Vos déclarations de contenu peuvent être définies n'importe où dans votre application dès qu'elles sont incluses dans le répertoire `contentDir` (par défaut, `./app`). Et correspondent à l'extension
|
|
208
|
+
> Vos déclarations de contenu peuvent être définies n'importe où dans votre application dès qu'elles sont incluses dans le répertoire `contentDir` (par défaut, `./app`). Et correspondent à l'extension des fichiers de déclaration de contenu (par défaut, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
233
209
|
|
|
234
|
-
> Pour plus de détails,
|
|
210
|
+
> Pour plus de détails, référez-vous à la [documentation sur la déclaration de contenu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/get_started.md).
|
|
235
211
|
|
|
236
212
|
### Étape 7 : Créez des composants sensibles à la locale
|
|
237
213
|
|
|
238
|
-
Créez un composant `LocalizedLink` pour
|
|
239
|
-
|
|
240
|
-
```tsx fileName="app/components/localized-link.tsx" codeFormat="typescript"
|
|
241
|
-
// app/components/localized-link.tsx
|
|
242
|
-
import { getLocalizedUrl } from "intlayer";
|
|
243
|
-
import { useLocale } from "react-intlayer";
|
|
244
|
-
import React from "react";
|
|
245
|
-
import { Link, useLocation } from "react-router";
|
|
214
|
+
Créez un composant `LocalizedLink` pour la navigation sensible à la locale :
|
|
246
215
|
|
|
247
|
-
|
|
216
|
+
```tsx fileName="app/components/localized-link.tsx"
|
|
217
|
+
import type { FC } from "react";
|
|
248
218
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
219
|
+
import { getLocalizedUrl, type LocalesValues } from "intlayer";
|
|
220
|
+
import { useLocale } from "react-intlayer";
|
|
221
|
+
import { Link, type LinkProps, type To } from "react-router";
|
|
252
222
|
|
|
253
|
-
|
|
254
|
-
/^([a-z][a-z0-9+.-]*:)?\/\//i.test(path) || path.startsWith("mailto:");
|
|
223
|
+
const isExternalLink = (to: string) => /^(https?:)?\/\//.test(to);
|
|
255
224
|
|
|
225
|
+
// Vérifie si le lien est externe
|
|
226
|
+
export const locacalizeTo = (to: To, locale: LocalesValues): To => {
|
|
256
227
|
if (typeof to === "string") {
|
|
257
|
-
if (
|
|
258
|
-
return
|
|
228
|
+
if (isExternalLink(to)) {
|
|
229
|
+
return to;
|
|
259
230
|
}
|
|
260
|
-
|
|
231
|
+
|
|
232
|
+
return getLocalizedUrl(to, locale);
|
|
261
233
|
}
|
|
262
234
|
|
|
263
|
-
if (to
|
|
264
|
-
|
|
265
|
-
if (pathname && pathname.startsWith("/") && !isExternal(pathname)) {
|
|
266
|
-
return (
|
|
267
|
-
<Link
|
|
268
|
-
to={{ ...to, pathname: getLocalizedUrl(pathname, locale) }}
|
|
269
|
-
{...props}
|
|
270
|
-
/>
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
return <Link to={to} {...props} />;
|
|
235
|
+
if (isExternalLink(to.pathname ?? "")) {
|
|
236
|
+
return to;
|
|
274
237
|
}
|
|
275
238
|
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
```
|
|
239
|
+
return {
|
|
240
|
+
...to,
|
|
241
|
+
pathname: getLocalizedUrl(to.pathname ?? "", locale),
|
|
242
|
+
};
|
|
243
|
+
};
|
|
284
244
|
|
|
285
|
-
|
|
245
|
+
// Composant LocalizedLink pour la navigation locale
|
|
246
|
+
export const LocalizedLink: FC<LinkProps> = (props) => {
|
|
247
|
+
const { locale } = useLocale();
|
|
286
248
|
|
|
287
|
-
|
|
249
|
+
return <Link {...props} to={locacalizeTo(props.to, locale)} />;
|
|
250
|
+
};
|
|
251
|
+
```
|
|
288
252
|
|
|
289
|
-
|
|
253
|
+
Dans le cas où vous souhaitez naviguer vers les routes localisées, vous pouvez utiliser le hook `useLocalizedNavigate` :
|
|
290
254
|
|
|
291
|
-
```tsx fileName="app/
|
|
292
|
-
|
|
293
|
-
import {
|
|
294
|
-
import { Navigate } from "react-router";
|
|
255
|
+
```tsx fileName="app/hooks/useLocalizedNavigate.ts"
|
|
256
|
+
import { useLocale } from "intlayer";
|
|
257
|
+
import { type NavigateOptions, type To, useNavigate } from "react-router";
|
|
295
258
|
|
|
296
|
-
|
|
259
|
+
import { locacalizeTo } from "~/components/localized-link";
|
|
260
|
+
|
|
261
|
+
export const useLocalizedNavigate = () => {
|
|
262
|
+
const navigate = useNavigate();
|
|
297
263
|
const { locale } = useLocale();
|
|
298
264
|
|
|
299
|
-
|
|
300
|
-
|
|
265
|
+
const localizedNavigate = (to: To, options?: NavigateOptions) => {
|
|
266
|
+
const localedTo = locacalizeTo(to, locale);
|
|
267
|
+
|
|
268
|
+
navigate(localedTo, options);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
return localizedNavigate;
|
|
272
|
+
};
|
|
301
273
|
```
|
|
302
274
|
|
|
275
|
+
### Étape 8 : Utilisez Intlayer dans vos pages
|
|
276
|
+
|
|
277
|
+
Accédez à vos dictionnaires de contenu dans toute votre application :
|
|
278
|
+
|
|
303
279
|
#### Page d'accueil localisée
|
|
304
280
|
|
|
305
|
-
```tsx fileName="app/routes/[lang]/page.tsx"
|
|
281
|
+
```tsx fileName="app/routes/[lang]/page.tsx"
|
|
306
282
|
import { useIntlayer } from "react-intlayer";
|
|
307
|
-
import LocalizedLink from "~/components/localized-link";
|
|
283
|
+
import { LocalizedLink } from "~/components/localized-link";
|
|
308
284
|
|
|
309
285
|
export default function Page() {
|
|
310
|
-
const
|
|
286
|
+
const { title, description, aboutLink } = useIntlayer("page");
|
|
311
287
|
|
|
312
288
|
return (
|
|
313
|
-
<div
|
|
314
|
-
<h1>{
|
|
315
|
-
<p>{
|
|
316
|
-
<nav
|
|
317
|
-
<LocalizedLink
|
|
318
|
-
to="/about"
|
|
319
|
-
style={{
|
|
320
|
-
display: "inline-block",
|
|
321
|
-
padding: "0.5rem 1rem",
|
|
322
|
-
backgroundColor: "#007bff",
|
|
323
|
-
color: "white",
|
|
324
|
-
textDecoration: "none",
|
|
325
|
-
borderRadius: "4px",
|
|
326
|
-
}}
|
|
327
|
-
>
|
|
328
|
-
{content.aboutLink}
|
|
329
|
-
</LocalizedLink>
|
|
289
|
+
<div>
|
|
290
|
+
<h1>{title}</h1>
|
|
291
|
+
<p>{description}</p>
|
|
292
|
+
<nav>
|
|
293
|
+
<LocalizedLink to="/about">{aboutLink}</LocalizedLink>
|
|
330
294
|
</nav>
|
|
331
295
|
</div>
|
|
332
296
|
);
|
|
@@ -339,43 +303,58 @@ export default function Page() {
|
|
|
339
303
|
|
|
340
304
|
Créez un composant pour permettre aux utilisateurs de changer de langue :
|
|
341
305
|
|
|
342
|
-
```tsx fileName="app/components/locale-switcher.tsx"
|
|
343
|
-
import {
|
|
344
|
-
import { useLocale } from "react-intlayer";
|
|
345
|
-
import { useLocation, useNavigate } from "react-router";
|
|
306
|
+
```tsx fileName="app/components/locale-switcher.tsx"
|
|
307
|
+
import type { FC } from "react";
|
|
346
308
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
309
|
+
import {
|
|
310
|
+
getHTMLTextDir,
|
|
311
|
+
getLocaleName,
|
|
312
|
+
getLocalizedUrl,
|
|
313
|
+
getPathWithoutLocale,
|
|
314
|
+
} from "intlayer";
|
|
315
|
+
import { setLocaleCookie, useIntlayer, useLocale } from "react-intlayer";
|
|
316
|
+
import { Link, useLocation } from "react-router";
|
|
351
317
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
};
|
|
318
|
+
export const LocaleSwitcher: FC = () => {
|
|
319
|
+
const { localeSwitcherLabel } = useIntlayer("locale-switcher");
|
|
320
|
+
const { pathname } = useLocation();
|
|
321
|
+
|
|
322
|
+
const { availableLocales, locale } = useLocale();
|
|
323
|
+
|
|
324
|
+
const pathWithoutLocale = getPathWithoutLocale(pathname);
|
|
360
325
|
|
|
361
326
|
return (
|
|
362
|
-
<
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
327
|
+
<ol>
|
|
328
|
+
{availableLocales.map((localeItem) => (
|
|
329
|
+
<li key={localeItem}>
|
|
330
|
+
<Link
|
|
331
|
+
aria-current={localeItem === locale ? "page" : undefined}
|
|
332
|
+
aria-label={`${localeSwitcherLabel.value} ${getLocaleName(localeItem)}`}
|
|
333
|
+
onClick={() => setLocaleCookie(localeItem)}
|
|
334
|
+
to={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
335
|
+
>
|
|
336
|
+
<span>
|
|
337
|
+
{/* Locale - par exemple FR */}
|
|
338
|
+
{localeItem}
|
|
339
|
+
</span>
|
|
340
|
+
<span>
|
|
341
|
+
{/* Langue dans sa propre locale - par exemple Français */}
|
|
342
|
+
{getLocaleName(localeItem, locale)}
|
|
343
|
+
</span>
|
|
344
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
345
|
+
{/* Langue dans la locale actuelle - par exemple Francés avec la locale actuelle définie sur Locales.SPANISH */}
|
|
346
|
+
{getLocaleName(localeItem)}
|
|
347
|
+
</span>
|
|
348
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
349
|
+
{/* Langue en anglais - par exemple French */}
|
|
350
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
351
|
+
</span>
|
|
352
|
+
</Link>
|
|
353
|
+
</li>
|
|
354
|
+
))}
|
|
355
|
+
</ol>
|
|
377
356
|
);
|
|
378
|
-
}
|
|
357
|
+
};
|
|
379
358
|
```
|
|
380
359
|
|
|
381
360
|
> Pour en savoir plus sur le hook `useLocale`, consultez la [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useLocale.md).
|
|
@@ -384,8 +363,7 @@ export default function LocaleSwitcher() {
|
|
|
384
363
|
|
|
385
364
|
Créez un hook pour gérer les attributs lang et dir du HTML :
|
|
386
365
|
|
|
387
|
-
```tsx fileName="app/hooks/useI18nHTMLAttributes.tsx"
|
|
388
|
-
// app/hooks/useI18nHTMLAttributes.tsx
|
|
366
|
+
```tsx fileName="app/hooks/useI18nHTMLAttributes.tsx"
|
|
389
367
|
import { getHTMLTextDir } from "intlayer";
|
|
390
368
|
import { useEffect } from "react";
|
|
391
369
|
import { useLocale } from "react-intlayer";
|
|
@@ -400,12 +378,11 @@ export const useI18nHTMLAttributes = () => {
|
|
|
400
378
|
};
|
|
401
379
|
```
|
|
402
380
|
|
|
403
|
-
|
|
381
|
+
Puis utilisez-le dans votre composant racine :
|
|
404
382
|
|
|
405
|
-
```tsx fileName="app/
|
|
406
|
-
// app/routes/layout.tsx
|
|
383
|
+
```tsx fileName="app/routes/layout.tsx"
|
|
407
384
|
import { Outlet } from "react-router";
|
|
408
|
-
import { IntlayerProvider } from "
|
|
385
|
+
import { IntlayerProvider } from "intlayer";
|
|
409
386
|
|
|
410
387
|
import { useI18nHTMLAttributes } from "app/hooks/useI18nHTMLAttributes"; // importer le hook
|
|
411
388
|
|
|
@@ -420,35 +397,26 @@ export default function RootLayout() {
|
|
|
420
397
|
}
|
|
421
398
|
```
|
|
422
399
|
|
|
423
|
-
### Étape 11 :
|
|
400
|
+
### Étape 11 : Ajouter un middleware (Optionnel)
|
|
424
401
|
|
|
425
|
-
|
|
402
|
+
Vous pouvez également utiliser le `intlayerMiddleware` 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.
|
|
426
403
|
|
|
427
|
-
|
|
428
|
-
# Construire les dictionnaires Intlayer
|
|
429
|
-
npm run intlayer:build
|
|
430
|
-
|
|
431
|
-
# Démarrer le serveur de développement
|
|
432
|
-
npm run dev
|
|
433
|
-
```
|
|
404
|
+
> Notez que pour utiliser le `intlayerMiddleware` en production, vous devez déplacer le package `vite-intlayer` de `devDependencies` vers `dependencies`.
|
|
434
405
|
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
|
|
406
|
+
```typescript {3,7} fileName="vite.config.ts"
|
|
407
|
+
import { defineConfig } from "vite";
|
|
408
|
+
import react from "@vitejs/plugin-react-swc";
|
|
409
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
438
410
|
|
|
439
|
-
|
|
440
|
-
|
|
411
|
+
// https://vitejs.dev/config/
|
|
412
|
+
export default defineConfig({
|
|
413
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
414
|
+
});
|
|
441
415
|
```
|
|
442
416
|
|
|
443
|
-
|
|
444
|
-
# Construire les dictionnaires Intlayer
|
|
445
|
-
yarn intlayer:build
|
|
446
|
-
|
|
447
|
-
# Démarrer le serveur de développement
|
|
448
|
-
yarn dev
|
|
449
|
-
```
|
|
417
|
+
---
|
|
450
418
|
|
|
451
|
-
|
|
419
|
+
## Configurer TypeScript
|
|
452
420
|
|
|
453
421
|
Intlayer utilise l'augmentation de module pour bénéficier de TypeScript et renforcer votre base de code.
|
|
454
422
|
|
|
@@ -456,9 +424,7 @@ Assurez-vous que votre configuration TypeScript inclut les types générés auto
|
|
|
456
424
|
|
|
457
425
|
```json5 fileName="tsconfig.json"
|
|
458
426
|
{
|
|
459
|
-
|
|
460
|
-
// ... vos configurations TypeScript existantes
|
|
461
|
-
},
|
|
427
|
+
// ... vos configurations existantes
|
|
462
428
|
include: [
|
|
463
429
|
// ... vos inclusions existantes
|
|
464
430
|
".intlayer/**/*.ts", // Inclure les types générés automatiquement
|
|
@@ -466,11 +432,13 @@ Assurez-vous que votre configuration TypeScript inclut les types générés auto
|
|
|
466
432
|
}
|
|
467
433
|
```
|
|
468
434
|
|
|
469
|
-
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Configuration Git
|
|
470
438
|
|
|
471
439
|
Il est recommandé d'ignorer les fichiers générés par Intlayer. Cela vous permet d'éviter de les commettre dans votre dépôt Git.
|
|
472
440
|
|
|
473
|
-
Pour ce faire, vous pouvez ajouter les instructions suivantes
|
|
441
|
+
Pour ce faire, vous pouvez ajouter les instructions suivantes à votre fichier `.gitignore` :
|
|
474
442
|
|
|
475
443
|
```plaintext fileName=".gitignore"
|
|
476
444
|
# Ignorer les fichiers générés par Intlayer
|
|
@@ -479,55 +447,26 @@ Pour ce faire, vous pouvez ajouter les instructions suivantes dans votre fichier
|
|
|
479
447
|
|
|
480
448
|
---
|
|
481
449
|
|
|
482
|
-
## Déploiement en Production
|
|
483
|
-
|
|
484
|
-
Lors du déploiement de votre application :
|
|
485
|
-
|
|
486
|
-
1. **Construisez votre application :**
|
|
487
|
-
|
|
488
|
-
```bash
|
|
489
|
-
npm run build
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
2. **Construisez les dictionnaires Intlayer :**
|
|
493
|
-
|
|
494
|
-
```bash
|
|
495
|
-
npm run intlayer:build
|
|
496
|
-
```
|
|
497
|
-
|
|
498
|
-
3. **Déplacez `vite-intlayer` dans les dépendances** si vous utilisez un middleware en production :
|
|
499
|
-
```bash
|
|
500
|
-
npm install vite-intlayer --save
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Votre application prendra désormais en charge :
|
|
504
|
-
|
|
505
|
-
- **Structure des URL** : `/en`, `/en/about`, `/tr`, `/tr/about`
|
|
506
|
-
- **Détection automatique de la langue** basée sur les préférences du navigateur
|
|
507
|
-
- **Routage sensible à la langue** avec React Router v7
|
|
508
|
-
- **Support TypeScript** avec des types générés automatiquement
|
|
509
|
-
- **Rendu côté serveur** avec une gestion correcte des langues
|
|
510
|
-
|
|
511
450
|
## Extension VS Code
|
|
512
451
|
|
|
513
|
-
Pour améliorer votre expérience de développement avec Intlayer, vous pouvez installer l
|
|
452
|
+
Pour améliorer votre expérience de développement avec Intlayer, vous pouvez installer l’**extension officielle Intlayer pour VS Code**.
|
|
514
453
|
|
|
515
454
|
[Installer depuis le Marketplace VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
516
455
|
|
|
517
456
|
Cette extension offre :
|
|
518
457
|
|
|
519
|
-
- **
|
|
520
|
-
- **
|
|
521
|
-
- **
|
|
522
|
-
- **
|
|
458
|
+
- **L’autocomplétion** pour les clés de traduction.
|
|
459
|
+
- **La détection d’erreurs en temps réel** pour les traductions manquantes.
|
|
460
|
+
- **Des aperçus en ligne** du contenu traduit.
|
|
461
|
+
- **Des actions rapides** pour créer et mettre à jour facilement les traductions.
|
|
523
462
|
|
|
524
|
-
Pour plus de détails sur l
|
|
463
|
+
Pour plus de détails sur l’utilisation de l’extension, consultez la [documentation de l’extension Intlayer pour VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
525
464
|
|
|
526
465
|
---
|
|
527
466
|
|
|
528
467
|
## Aller plus loin
|
|
529
468
|
|
|
530
|
-
Pour aller plus loin, vous pouvez implémenter l
|
|
469
|
+
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).
|
|
531
470
|
|
|
532
471
|
---
|
|
533
472
|
|
|
@@ -536,7 +475,7 @@ Pour aller plus loin, vous pouvez implémenter l'[éditeur visuel](https://githu
|
|
|
536
475
|
- [Documentation Intlayer](https://intlayer.org)
|
|
537
476
|
- [Documentation React Router v7](https://reactrouter.com/)
|
|
538
477
|
- [Hook useIntlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useIntlayer.md)
|
|
539
|
-
- [useLocale
|
|
478
|
+
- [Hook useLocale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useLocale.md)
|
|
540
479
|
- [Déclaration de contenu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/get_started.md)
|
|
541
480
|
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/configuration.md)
|
|
542
481
|
|
|
@@ -544,6 +483,7 @@ Ce guide complet vous fournit tout ce dont vous avez besoin pour intégrer Intla
|
|
|
544
483
|
|
|
545
484
|
## Historique de la documentation
|
|
546
485
|
|
|
547
|
-
| Version | Date
|
|
548
|
-
| ------- |
|
|
549
|
-
|
|
|
486
|
+
| Version | Date | Modifications |
|
|
487
|
+
| ------- | ---------- | -------------------------- |
|
|
488
|
+
| 6.1.5 | 2025-10-03 | Documentation mise à jour |
|
|
489
|
+
| 5.8.2 | 2025-09-04 | Ajout pour React Router v7 |
|