@intlayer/docs 8.1.5 → 8.1.7
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/README.md +18 -9
- package/dist/cjs/generated/docs.entry.cjs +1 -1
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +1 -1
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/compiler.md +26 -0
- package/docs/ar/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/ar/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/ar/readme.md +138 -110
- package/docs/de/compiler.md +26 -0
- package/docs/de/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/de/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/de/readme.md +152 -124
- package/docs/en/compiler.md +27 -0
- package/docs/en/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/en/intlayer_with_vite+react_compiler.md +368 -0
- package/docs/en/readme.md +129 -105
- package/docs/en-GB/compiler.md +26 -0
- package/docs/en-GB/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/en-GB/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/en-GB/readme.md +134 -108
- package/docs/es/compiler.md +26 -0
- package/docs/es/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/es/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/es/readme.md +149 -121
- package/docs/fr/compiler.md +26 -0
- package/docs/fr/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/fr/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/fr/readme.md +150 -122
- package/docs/hi/compiler.md +26 -0
- package/docs/hi/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/hi/intlayer_with_vite+react_compiler.md +370 -0
- package/docs/hi/readme.md +153 -125
- package/docs/id/compiler.md +26 -0
- package/docs/id/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/id/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/id/readme.md +133 -105
- package/docs/it/compiler.md +26 -0
- package/docs/it/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/it/intlayer_with_vite+react_compiler.md +374 -0
- package/docs/it/readme.md +155 -127
- package/docs/ja/compiler.md +26 -0
- package/docs/ja/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/ja/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/ja/readme.md +152 -126
- package/docs/ko/compiler.md +26 -0
- package/docs/ko/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/ko/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/ko/readme.md +154 -126
- package/docs/pl/compiler.md +26 -0
- package/docs/pl/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/pl/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/pl/readme.md +134 -106
- package/docs/pt/compiler.md +27 -1
- package/docs/pt/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/pt/intlayer_with_vite+react_compiler.md +374 -0
- package/docs/pt/readme.md +154 -126
- package/docs/ru/compiler.md +26 -0
- package/docs/ru/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/ru/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/ru/readme.md +137 -109
- package/docs/tr/compiler.md +26 -0
- package/docs/tr/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/tr/intlayer_with_vite+react_compiler.md +375 -0
- package/docs/tr/readme.md +139 -111
- package/docs/uk/compiler.md +26 -0
- package/docs/uk/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/uk/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/uk/readme.md +133 -109
- package/docs/vi/compiler.md +27 -1
- package/docs/vi/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/vi/intlayer_with_vite+react_compiler.md +369 -0
- package/docs/vi/readme.md +138 -110
- package/docs/zh/compiler.md +26 -0
- package/docs/zh/intlayer_with_nextjs_compiler.md +481 -0
- package/docs/zh/intlayer_with_vite+react_compiler.md +372 -0
- package/docs/zh/readme.md +148 -120
- package/package.json +7 -8
- package/src/generated/docs.entry.ts +40 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-12-30
|
|
4
|
+
title: Vite et React i18n - Transformer une application existante en une application multilingue (guide i18n 2026)
|
|
5
|
+
description: Découvrez comment rendre votre application Vite et React existante multilingue à l'aide d'Intlayer Compiler. Suivez la documentation pour l'internationaliser (i18n) et la traduire avec l'IA.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internationalisation
|
|
8
|
+
- Documentation
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- React
|
|
12
|
+
- Compilateur
|
|
13
|
+
- IA
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- vite-and-react
|
|
18
|
+
- compilateur
|
|
19
|
+
- IA
|
|
20
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
21
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
22
|
+
history:
|
|
23
|
+
- version: 8.1.6
|
|
24
|
+
date: 2026-02-23
|
|
25
|
+
changes: Sortie initiale
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Comment rendre multilingue (i18n) une application Vite et React existante après coup (guide i18n 2026)
|
|
29
|
+
|
|
30
|
+
<Tabs defaultTab="video">
|
|
31
|
+
<Tab label="Vidéo" value="video">
|
|
32
|
+
|
|
33
|
+
<iframe title="La meilleure solution i18n pour Vite et React ? Découvrez 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?si=VaKmrYMmXjo3xpk2"/>
|
|
34
|
+
|
|
35
|
+
</Tab>
|
|
36
|
+
<Tab label="Code" value="code">
|
|
37
|
+
|
|
38
|
+
<iframe
|
|
39
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-react-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
40
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
41
|
+
title="Démo CodeSandbox - Comment internationaliser votre application à l'aide d'Intlayer"
|
|
42
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
43
|
+
loading="lazy"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
</Tab>
|
|
47
|
+
</Tabs>
|
|
48
|
+
|
|
49
|
+
Voir le [Modèle d'application](https://github.com/aymericzip/intlayer-vite-react-template) sur GitHub.
|
|
50
|
+
|
|
51
|
+
## Table des matières
|
|
52
|
+
|
|
53
|
+
<TOC/>
|
|
54
|
+
|
|
55
|
+
## Pourquoi est-il difficile d'internationaliser une application existante ?
|
|
56
|
+
|
|
57
|
+
Si vous avez déjà essayé d'ajouter plusieurs langues à une application conçue pour une seule, vous connaissez la douleur. Ce n'est pas seulement « difficile », c'est fastidieux. Vous devez passer au peigne fin chaque fichier, traquer chaque chaîne de texte et les déplacer dans des fichiers de dictionnaire séparés.
|
|
58
|
+
|
|
59
|
+
Vient ensuite la partie risquée : remplacer tout ce texte par des hooks de code sans casser votre mise en page ou votre logique. C'est le genre de travail qui interrompt le développement de nouvelles fonctionnalités pendant des semaines et ressemble à un refactoring sans fin.
|
|
60
|
+
|
|
61
|
+
## Qu'est-ce que l'Intlayer Compiler ?
|
|
62
|
+
|
|
63
|
+
L'**Intlayer Compiler** a été conçu pour éviter ce travail manuel ingrat. Au lieu que vous extrayiez manuellement les chaînes, le compilateur le fait pour vous. Il scanne votre code, trouve le texte et utilise l'IA pour générer les dictionnaires en coulisses.
|
|
64
|
+
Ensuite, il modifie votre code pendant le build pour injecter les hooks i18n nécessaires. Fondamentalement, vous continuez à écrire votre application comme s'il s'agissait d'une application unilingue, et le compilateur gère automatiquement la transformation multilingue.
|
|
65
|
+
|
|
66
|
+
> Doc Compiler : [https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/compiler.md](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/compiler.md)
|
|
67
|
+
|
|
68
|
+
### Limitations
|
|
69
|
+
|
|
70
|
+
Parce que le compilateur effectue l'analyse et la transformation du code (insertion de hooks et génération de dictionnaires) au moment de la **compilation**, il peut **ralentir le processus de build** de votre application.
|
|
71
|
+
|
|
72
|
+
Pour atténuer cet impact pendant le développement, vous pouvez configurer le compilateur pour qu'il s'exécute en mode [`'build-only'`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/configuration.md) ou le désactiver lorsque vous n'en avez pas besoin.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Guide étape par étape pour configurer Intlayer dans une application Vite et React
|
|
77
|
+
|
|
78
|
+
### Étape 1 : Installer les dépendances
|
|
79
|
+
|
|
80
|
+
Installez les packages nécessaires avec npm :
|
|
81
|
+
|
|
82
|
+
```bash packageManager="npm"
|
|
83
|
+
npm install intlayer react-intlayer
|
|
84
|
+
npm install vite-intlayer --save-dev
|
|
85
|
+
npx intlayer init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```bash packageManager="pnpm"
|
|
89
|
+
pnpm add intlayer react-intlayer
|
|
90
|
+
pnpm add vite-intlayer --save-dev
|
|
91
|
+
pnpm intlayer init
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash packageManager="yarn"
|
|
95
|
+
yarn add intlayer react-intlayer
|
|
96
|
+
yarn add vite-intlayer --save-dev
|
|
97
|
+
yarn intlayer init
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```bash packageManager="bun"
|
|
101
|
+
bun add intlayer react-intlayer
|
|
102
|
+
bun add vite-intlayer --dev
|
|
103
|
+
bunx intlayer init
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- **intlayer**
|
|
107
|
+
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/content_file.md), la transpilation et les [commandes CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/index.md).
|
|
108
|
+
|
|
109
|
+
- **react-intlayer**
|
|
110
|
+
Le package qui intègre Intlayer avec l'application React. Il fournit des fournisseurs de contexte et des hooks pour l'internationalisation de React.
|
|
111
|
+
|
|
112
|
+
- **vite-intlayer**
|
|
113
|
+
Comprend le plugin Vite pour intégrer Intlayer avec le [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), ainsi qu'un middleware pour détecter la langue préférée de l'utilisateur, gérer les cookies et gérer la redirection d'URL.
|
|
114
|
+
|
|
115
|
+
### Étape 2 : Configurer votre projet
|
|
116
|
+
|
|
117
|
+
Créez un fichier de configuration pour configurer les langues de votre application :
|
|
118
|
+
|
|
119
|
+
```typescript fileName="intlayer.config.ts"
|
|
120
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
121
|
+
|
|
122
|
+
const config: IntlayerConfig = {
|
|
123
|
+
internationalization: {
|
|
124
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
125
|
+
defaultLocale: Locales.ENGLISH,
|
|
126
|
+
},
|
|
127
|
+
compiler: {
|
|
128
|
+
enabled: true, // Peut être réglé sur 'build-only' pour limiter l'impact sur le mode dev
|
|
129
|
+
outputDir: "i18n",
|
|
130
|
+
dictionaryKeyPrefix: "", // Pas de préfixe comp-
|
|
131
|
+
},
|
|
132
|
+
ai: {
|
|
133
|
+
provider: "openai",
|
|
134
|
+
model: "gpt-5-mini",
|
|
135
|
+
apiKey: process.env.OPEN_AI_API_KEY,
|
|
136
|
+
applicationContext: "This app is an map app", // Note : vous pouvez personnaliser cette description de l'application
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default config;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
> **Note** : Assurez-vous d'avoir votre `OPEN_AI_API_KEY` définie dans vos variables d'environnement.
|
|
144
|
+
|
|
145
|
+
> Grâce à ce fichier de configuration, vous pouvez configurer des URL localisées, la redirection du 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 plus encore. Pour une liste complète des paramètres disponibles, reportez-vous à la [documentation de configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/configuration.md).
|
|
146
|
+
|
|
147
|
+
### Étape 3 : Intégrer Intlayer dans votre configuration Vite
|
|
148
|
+
|
|
149
|
+
Ajoutez le plugin intlayer dans votre configuration.
|
|
150
|
+
|
|
151
|
+
```typescript fileName="vite.config.ts"
|
|
152
|
+
import { defineConfig } from "vite";
|
|
153
|
+
import react from "@vitejs/plugin-react-swc";
|
|
154
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
155
|
+
|
|
156
|
+
// https://vitejs.dev/config/
|
|
157
|
+
export default defineConfig({
|
|
158
|
+
plugins: [react(), intlayer(), intlayerCompiler()],
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
> Le plugin Vite `intlayer()` est utilisé pour intégrer Intlayer avec Vite. Il assure la construction 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
|
+
|
|
164
|
+
> Le plugin Vite `intlayerCompiler()` est utilisé pour extraire le contenu des composants et écrire des fichiers `.content`.
|
|
165
|
+
|
|
166
|
+
### Étape 4 : Compiler votre code
|
|
167
|
+
|
|
168
|
+
Écrivez simplement vos composants avec des chaînes codées en dur dans votre langue par défaut. Le compilateur s'occupe du reste.
|
|
169
|
+
|
|
170
|
+
Exemple de ce à quoi pourrait ressembler votre page :
|
|
171
|
+
|
|
172
|
+
<Tabs>
|
|
173
|
+
<Tab value="Code">
|
|
174
|
+
|
|
175
|
+
```tsx fileName="src/App.tsx"
|
|
176
|
+
import { useState, type FC } from "react";
|
|
177
|
+
import reactLogo from "./assets/react.svg";
|
|
178
|
+
import viteLogo from "/vite.svg";
|
|
179
|
+
import "./App.css";
|
|
180
|
+
import { IntlayerProvider } from "react-intlayer";
|
|
181
|
+
|
|
182
|
+
const AppContent: FC = () => {
|
|
183
|
+
const [count, setCount] = useState(0);
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<>
|
|
187
|
+
<div>
|
|
188
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
189
|
+
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
190
|
+
</a>
|
|
191
|
+
<a href="https://react.dev" target="_blank">
|
|
192
|
+
<img src={reactLogo} className="logo react" alt="React logo" />
|
|
193
|
+
</a>
|
|
194
|
+
</div>
|
|
195
|
+
<h1>Vite + React</h1>
|
|
196
|
+
<div className="card">
|
|
197
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
198
|
+
count is {count}
|
|
199
|
+
</button>
|
|
200
|
+
<p>
|
|
201
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
202
|
+
</p>
|
|
203
|
+
</div>
|
|
204
|
+
<p className="read-the-docs">
|
|
205
|
+
Click on the Vite and React logos to learn more
|
|
206
|
+
</p>
|
|
207
|
+
</>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const App: FC = () => (
|
|
212
|
+
<IntlayerProvider>
|
|
213
|
+
<AppContent />
|
|
214
|
+
</IntlayerProvider>
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
export default App;
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
</Tab>
|
|
221
|
+
<Tab value="Sortie">
|
|
222
|
+
|
|
223
|
+
```ts fileName="i18n/app-content.content.json"
|
|
224
|
+
{
|
|
225
|
+
key: "app-content",
|
|
226
|
+
content: {
|
|
227
|
+
nodeType: "translation",
|
|
228
|
+
translation: {
|
|
229
|
+
en: {
|
|
230
|
+
viteLogo: "Vite logo",
|
|
231
|
+
reactLogo: "React logo",
|
|
232
|
+
title: "Vite + React",
|
|
233
|
+
countButton: "count is",
|
|
234
|
+
editMessage: "Edit",
|
|
235
|
+
hmrMessage: "and save to test HMR",
|
|
236
|
+
readTheDocs: "Click on the Vite and React logos to learn more",
|
|
237
|
+
},
|
|
238
|
+
fr: {
|
|
239
|
+
viteLogo: "Logo Vite",
|
|
240
|
+
reactLogo: "Logo React",
|
|
241
|
+
title: "Vite + React",
|
|
242
|
+
countButton: "compte est",
|
|
243
|
+
editMessage: "Modifier",
|
|
244
|
+
hmrMessage: "et enregistrer pour tester HMR",
|
|
245
|
+
readTheDocs: "Cliquez sur les logos Vite et React pour en savoir plus",
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```tsx fileName="src/App.tsx"
|
|
253
|
+
import { useState, type FC } from "react";
|
|
254
|
+
import reactLogo from "./assets/react.svg";
|
|
255
|
+
import viteLogo from "/vite.svg";
|
|
256
|
+
import "./App.css";
|
|
257
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
258
|
+
|
|
259
|
+
const AppContent: FC = () => {
|
|
260
|
+
const [count, setCount] = useState(0);
|
|
261
|
+
const content = useIntlayer("app-content");
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<>
|
|
265
|
+
<div>
|
|
266
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
267
|
+
<img src={viteLogo} className="logo" alt={content.viteLogo.value} />
|
|
268
|
+
</a>
|
|
269
|
+
<a href="https://react.dev" target="_blank">
|
|
270
|
+
<img
|
|
271
|
+
src={reactLogo}
|
|
272
|
+
className="logo react"
|
|
273
|
+
alt={content.reactLogo.value}
|
|
274
|
+
/>
|
|
275
|
+
</a>
|
|
276
|
+
</div>
|
|
277
|
+
<h1>{content.title}</h1>
|
|
278
|
+
<div className="card">
|
|
279
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
280
|
+
{content.countButton} {count}
|
|
281
|
+
</button>
|
|
282
|
+
<p>
|
|
283
|
+
{content.editMessage} <code>src/App.tsx</code> {content.hmrMessage}
|
|
284
|
+
</p>
|
|
285
|
+
</div>
|
|
286
|
+
<p className="read-the-docs">{content.readTheDocs}</p>
|
|
287
|
+
</>
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const App: FC = () => (
|
|
292
|
+
<IntlayerProvider>
|
|
293
|
+
<AppContent />
|
|
294
|
+
</IntlayerProvider>
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
export default App;
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
</Tab>
|
|
301
|
+
</Tabs>
|
|
302
|
+
|
|
303
|
+
- **`IntlayerProvider`** est utilisé pour fournir la langue aux composants imbriqués.
|
|
304
|
+
|
|
305
|
+
### (Facultatif) Étape 6 : Changer la langue de votre contenu
|
|
306
|
+
|
|
307
|
+
Pour changer la langue de votre contenu, vous pouvez utiliser la fonction `setLocale` fournie par le hook `useLocale`. Cette fonction vous permet de définir la langue de l'application et de mettre à jour le contenu en conséquence.
|
|
308
|
+
|
|
309
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx"
|
|
310
|
+
import type { FC } from "react";
|
|
311
|
+
import { Locales } from "intlayer";
|
|
312
|
+
import { useLocale } from "react-intlayer";
|
|
313
|
+
|
|
314
|
+
const LocaleSwitcher: FC = () => {
|
|
315
|
+
const { setLocale } = useLocale();
|
|
316
|
+
|
|
317
|
+
return (
|
|
318
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
319
|
+
Change Language to English
|
|
320
|
+
</button>
|
|
321
|
+
);
|
|
322
|
+
};
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
> Pour en savoir plus sur le hook `useLocale`, reportez-vous à la [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/packages/react-intlayer/useLocale.md).
|
|
326
|
+
|
|
327
|
+
### (Facultatif) Étape 7 : Remplir les traductions manquantes
|
|
328
|
+
|
|
329
|
+
Intlayer fournit un outil CLI pour vous aider à remplir les traductions manquantes. Vous pouvez utiliser la commande `intlayer` pour tester et remplir les traductions manquantes à partir de votre code.
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
npx intlayer test # Tester s'il y a des traductions manquantes
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
npx intlayer fill # Remplir les traductions manquantes
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
> Pour plus de détails, consultez la [documentation CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/ci.md)
|
|
340
|
+
|
|
341
|
+
### Configuration Git
|
|
342
|
+
|
|
343
|
+
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.
|
|
344
|
+
|
|
345
|
+
Pour ce faire, vous pouvez ajouter les instructions suivantes à votre fichier `.gitignore` :
|
|
346
|
+
|
|
347
|
+
```plaintext fileName=".gitignore"
|
|
348
|
+
# Ignorer les fichiers générés par Intlayer
|
|
349
|
+
.intlayer
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Extension VS Code
|
|
353
|
+
|
|
354
|
+
Pour améliorer votre expérience de développement avec Intlayer, vous pouvez installer l'officielle **Extension Intlayer VS Code**.
|
|
355
|
+
|
|
356
|
+
[Installer depuis le VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
357
|
+
|
|
358
|
+
Cette extension fournit :
|
|
359
|
+
|
|
360
|
+
- **L'autocomplétion** pour les clés de traduction.
|
|
361
|
+
- **La détection d'erreurs en temps réel** for les traductions manquantes.
|
|
362
|
+
- **Des aperçus en ligne** du contenu traduit.
|
|
363
|
+
- **Des actions rapides** pour créer et mettre à jour facilement des traductions.
|
|
364
|
+
|
|
365
|
+
Pour plus de détails sur l'utilisation de l'extension, reportez-vous à la [documentation de l'extension Intlayer VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
366
|
+
|
|
367
|
+
### Aller plus loin
|
|
368
|
+
|
|
369
|
+
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 à l'aide du [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_CMS.md).
|