@intlayer/docs 7.0.3 → 7.0.4

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.
Files changed (159) hide show
  1. package/blog/ar/intlayer_with_i18next.md +68 -106
  2. package/blog/ar/intlayer_with_next-i18next.md +84 -288
  3. package/blog/ar/intlayer_with_next-intl.md +58 -337
  4. package/blog/ar/intlayer_with_react-i18next.md +68 -290
  5. package/blog/ar/intlayer_with_react-intl.md +63 -266
  6. package/blog/de/intlayer_with_i18next.md +77 -97
  7. package/blog/de/intlayer_with_next-i18next.md +69 -296
  8. package/blog/de/intlayer_with_next-intl.md +59 -340
  9. package/blog/de/intlayer_with_react-i18next.md +68 -290
  10. package/blog/de/intlayer_with_react-intl.md +62 -264
  11. package/blog/en/intlayer_with_i18next.md +67 -103
  12. package/blog/en/intlayer_with_next-i18next.md +69 -294
  13. package/blog/en/intlayer_with_next-intl.md +48 -300
  14. package/blog/en/intlayer_with_react-i18next.md +61 -289
  15. package/blog/en/intlayer_with_react-intl.md +61 -284
  16. package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +1 -1
  17. package/blog/en-GB/intlayer_with_i18next.md +67 -103
  18. package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
  19. package/blog/en-GB/intlayer_with_next-intl.md +58 -337
  20. package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
  21. package/blog/en-GB/intlayer_with_react-intl.md +61 -264
  22. package/blog/es/intlayer_with_i18next.md +67 -103
  23. package/blog/es/intlayer_with_next-i18next.md +71 -296
  24. package/blog/es/intlayer_with_next-intl.md +57 -338
  25. package/blog/es/intlayer_with_react-i18next.md +68 -290
  26. package/blog/es/intlayer_with_react-intl.md +62 -265
  27. package/blog/fr/intlayer_with_i18next.md +66 -104
  28. package/blog/fr/intlayer_with_next-i18next.md +82 -285
  29. package/blog/fr/intlayer_with_next-intl.md +57 -338
  30. package/blog/fr/intlayer_with_react-i18next.md +67 -289
  31. package/blog/fr/intlayer_with_react-intl.md +61 -264
  32. package/blog/hi/intlayer_with_i18next.md +68 -104
  33. package/blog/hi/intlayer_with_next-i18next.md +74 -299
  34. package/blog/hi/intlayer_with_next-intl.md +57 -239
  35. package/blog/hi/intlayer_with_react-i18next.md +69 -291
  36. package/blog/hi/intlayer_with_react-intl.md +65 -268
  37. package/blog/id/intlayer_with_i18next.md +126 -0
  38. package/blog/id/intlayer_with_next-i18next.md +142 -0
  39. package/blog/id/intlayer_with_next-intl.md +113 -0
  40. package/blog/id/intlayer_with_react-i18next.md +124 -0
  41. package/blog/id/intlayer_with_react-intl.md +122 -0
  42. package/blog/it/intlayer_with_i18next.md +67 -103
  43. package/blog/it/intlayer_with_next-i18next.md +71 -296
  44. package/blog/it/intlayer_with_next-intl.md +57 -338
  45. package/blog/it/intlayer_with_react-i18next.md +68 -290
  46. package/blog/it/intlayer_with_react-intl.md +62 -265
  47. package/blog/ja/intlayer_with_i18next.md +68 -103
  48. package/blog/ja/intlayer_with_next-i18next.md +85 -283
  49. package/blog/ja/intlayer_with_next-intl.md +58 -336
  50. package/blog/ja/intlayer_with_react-i18next.md +68 -290
  51. package/blog/ja/intlayer_with_react-intl.md +62 -264
  52. package/blog/ko/intlayer_with_i18next.md +80 -96
  53. package/blog/ko/intlayer_with_next-i18next.md +85 -287
  54. package/blog/ko/intlayer_with_next-intl.md +68 -327
  55. package/blog/ko/intlayer_with_react-i18next.md +68 -290
  56. package/blog/ko/intlayer_with_react-intl.md +64 -266
  57. package/blog/pl/intlayer_with_i18next.md +126 -0
  58. package/blog/pl/intlayer_with_next-i18next.md +142 -0
  59. package/blog/pl/intlayer_with_next-intl.md +111 -0
  60. package/blog/pl/intlayer_with_react-i18next.md +124 -0
  61. package/blog/pl/intlayer_with_react-intl.md +122 -0
  62. package/blog/pt/intlayer_with_i18next.md +67 -103
  63. package/blog/pt/intlayer_with_next-i18next.md +72 -293
  64. package/blog/pt/intlayer_with_next-intl.md +57 -256
  65. package/blog/pt/intlayer_with_react-i18next.md +104 -78
  66. package/blog/pt/intlayer_with_react-intl.md +62 -266
  67. package/blog/ru/intlayer_with_i18next.md +66 -104
  68. package/blog/ru/intlayer_with_next-i18next.md +71 -296
  69. package/blog/ru/intlayer_with_next-intl.md +58 -337
  70. package/blog/ru/intlayer_with_react-i18next.md +68 -290
  71. package/blog/ru/intlayer_with_react-intl.md +62 -265
  72. package/blog/tr/intlayer_with_i18next.md +71 -107
  73. package/blog/tr/intlayer_with_next-i18next.md +72 -297
  74. package/blog/tr/intlayer_with_next-intl.md +58 -339
  75. package/blog/tr/intlayer_with_react-i18next.md +69 -291
  76. package/blog/tr/intlayer_with_react-intl.md +63 -285
  77. package/blog/vi/intlayer_with_i18next.md +126 -0
  78. package/blog/vi/intlayer_with_next-i18next.md +142 -0
  79. package/blog/vi/intlayer_with_next-intl.md +111 -0
  80. package/blog/vi/intlayer_with_react-i18next.md +124 -0
  81. package/blog/vi/intlayer_with_react-intl.md +122 -0
  82. package/blog/zh/intlayer_with_i18next.md +67 -102
  83. package/blog/zh/intlayer_with_next-i18next.md +72 -296
  84. package/blog/zh/intlayer_with_next-intl.md +58 -336
  85. package/blog/zh/intlayer_with_react-i18next.md +68 -290
  86. package/blog/zh/intlayer_with_react-intl.md +63 -106
  87. package/dist/cjs/generated/blog.entry.cjs +13 -1
  88. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  89. package/dist/cjs/generated/docs.entry.cjs +13 -1
  90. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  91. package/dist/cjs/generated/frequentQuestions.entry.cjs +13 -1
  92. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  93. package/dist/cjs/generated/legal.entry.cjs +13 -1
  94. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  95. package/dist/esm/generated/blog.entry.mjs +13 -2
  96. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  97. package/dist/esm/generated/docs.entry.mjs +13 -2
  98. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  99. package/dist/esm/generated/frequentQuestions.entry.mjs +13 -2
  100. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  101. package/dist/esm/generated/legal.entry.mjs +13 -2
  102. package/dist/esm/generated/legal.entry.mjs.map +1 -1
  103. package/dist/types/generated/blog.entry.d.ts.map +1 -1
  104. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  105. package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
  106. package/dist/types/generated/legal.entry.d.ts.map +1 -1
  107. package/docs/ar/plugins/sync-json.md +244 -0
  108. package/docs/de/plugins/sync-json.md +244 -0
  109. package/docs/de/releases/v7.md +1 -18
  110. package/docs/en/CI_CD.md +1 -1
  111. package/docs/en/configuration.md +1 -1
  112. package/docs/en/formatters.md +1 -1
  113. package/docs/en/how_works_intlayer.md +1 -1
  114. package/docs/en/intlayer_CMS.md +1 -1
  115. package/docs/en/intlayer_cli.md +26 -1
  116. package/docs/en/intlayer_with_nextjs_14.md +3 -1
  117. package/docs/en/intlayer_with_nextjs_15.md +3 -1
  118. package/docs/en/intlayer_with_nextjs_16.md +3 -1
  119. package/docs/en/intlayer_with_nextjs_page_router.md +1 -1
  120. package/docs/en/intlayer_with_nuxt.md +1 -1
  121. package/docs/en/intlayer_with_react_native+expo.md +1 -1
  122. package/docs/en/intlayer_with_react_router_v7.md +1 -1
  123. package/docs/en/intlayer_with_tanstack.md +1 -1
  124. package/docs/en/intlayer_with_vite+preact.md +1 -1
  125. package/docs/en/intlayer_with_vite+react.md +1 -1
  126. package/docs/en/intlayer_with_vite+solid.md +1 -1
  127. package/docs/en/intlayer_with_vite+svelte.md +1 -1
  128. package/docs/en/intlayer_with_vite+vue.md +1 -1
  129. package/docs/en/plugins/sync-json.md +1 -1
  130. package/docs/en/roadmap.md +1 -1
  131. package/docs/en-GB/plugins/sync-json.md +244 -0
  132. package/docs/es/plugins/sync-json.md +244 -0
  133. package/docs/es/releases/v7.md +1 -18
  134. package/docs/fr/intlayer_with_nextjs_16.md +2 -51
  135. package/docs/fr/plugins/sync-json.md +244 -0
  136. package/docs/fr/releases/v7.md +1 -18
  137. package/docs/hi/intlayer_with_nextjs_16.md +3 -2
  138. package/docs/hi/plugins/sync-json.md +244 -0
  139. package/docs/id/plugins/sync-json.md +244 -0
  140. package/docs/id/releases/v7.md +1 -18
  141. package/docs/it/plugins/sync-json.md +244 -0
  142. package/docs/it/releases/v7.md +1 -18
  143. package/docs/ja/intlayer_with_nextjs_16.md +44 -205
  144. package/docs/ja/plugins/sync-json.md +244 -0
  145. package/docs/ja/releases/v7.md +1 -18
  146. package/docs/ko/plugins/sync-json.md +244 -0
  147. package/docs/ko/releases/v7.md +1 -18
  148. package/docs/pl/plugins/sync-json.md +244 -0
  149. package/docs/pt/intlayer_with_nextjs_16.md +1 -52
  150. package/docs/pt/plugins/sync-json.md +244 -0
  151. package/docs/ru/plugins/sync-json.md +244 -0
  152. package/docs/tr/plugins/sync-json.md +245 -0
  153. package/docs/vi/plugins/sync-json.md +244 -0
  154. package/docs/zh/plugins/sync-json.md +244 -0
  155. package/package.json +14 -14
  156. package/src/generated/blog.entry.ts +26 -3
  157. package/src/generated/docs.entry.ts +26 -3
  158. package/src/generated/frequentQuestions.entry.ts +26 -3
  159. package/src/generated/legal.entry.ts +26 -3
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  createdAt: 2025-01-02
3
3
  updatedAt: 2025-10-29
4
- title: Intlayer and react-i18next
5
- description: Compare Intlayer with react-i18next for a React app
4
+ title: How to automate your react-i18next JSON translations using Intlayer
5
+ description: Automate your JSON translations with Intlayer and react-i18next for enhanced internationalization in React applications.
6
6
  keywords:
7
7
  - react-i18next
8
8
  - i18next
9
9
  - Intlayer
10
10
  - Internationalization
11
+ - i18n
11
12
  - Blog
12
- - Next.js
13
- - JavaScript
14
13
  - React
14
+ - JavaScript
15
+ - TypeScript
16
+ - Content Management
15
17
  slugs:
16
18
  - blog
17
19
  - intlayer-with-react-i18next
@@ -21,110 +23,71 @@ history:
21
23
  changes: Change to syncJSON plugin
22
24
  ---
23
25
 
24
- # React Internationalization (i18n) with react-i18next and Intlayer
26
+ # How to automate your react-i18next JSON translations using Intlayer
27
+
28
+ ## What is Intlayer?
29
+
30
+ **Intlayer** is an innovative, open-source internationalization library designed to address the shortcomings of traditional i18n solutions. It offers a modern approach to content management in React applications.
25
31
 
26
- ## Overview
32
+ See a concrete comparison with react-i18next in our [react-i18next vs. react-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/en/react-i18next_vs_react-intl_vs_intlayer.md) blog post.
27
33
 
28
- - **Intlayer** helps you manage translations via **component-level** content declaration files.
29
- - **react-i18next** is a popular React integration for **i18next** that provides hooks like `useTranslation` to fetch localized strings in your components.
34
+ ## Why Combine Intlayer with react-i18next?
30
35
 
31
- When combined, Intlayer can **export** dictionaries in **i18next-compatible JSON** so that react-i18next can **consume** them at runtime.
36
+ While Intlayer provides an excellent standalone i18n solution (see our [React integration guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_vite+react.md)), you might want to combine it with react-i18next for several reasons:
37
+
38
+ 1. **Existing codebase**: You have an established react-i18next implementation and want to gradually migrate to Intlayer's improved developer experience.
39
+ 2. **Legacy requirements**: Your project requires compatibility with existing react-i18next plugins or workflows.
40
+ 3. **Team familiarity**: Your team is comfortable with react-i18next but wants better content management.
41
+
42
+ **For that, Intlayer can be implemented as an adapter for react-i18next to help automating your JSON translations in CLI or CI/CD pipelines, testing your translations, and more.**
43
+
44
+ This guide shows you how to leverage Intlayer's superior content declaration system while maintaining compatibility with react-i18next.
32
45
 
33
46
  ## Table of Contents
34
47
 
35
- <TOC>
36
-
37
- ## Why Use Intlayer with react-i18next?
38
-
39
- **Intlayer** content declaration files offer a better developer experience because they are:
40
-
41
- 1. **Flexible in File Placement**
42
- Put each content declaration file right next to the component that needs it. This structure allows you to keep translations co-located, preventing orphaned translations when components move or get deleted.
43
-
44
- ```bash codeFormat="typescript"
45
- .
46
- └── src
47
- └── components
48
- └── MyComponent
49
- ├── index.content.ts # Content declaration file
50
- └── index.tsx
51
- ```
52
-
53
- ```bash codeFormat="esm"
54
- .
55
- └── src
56
- └── components
57
- └── MyComponent
58
- ├── index.content.mjs # Content declaration file
59
- └── index.mjx
60
- ```
61
-
62
- ```bash codeFormat="cjs"
63
- .
64
- └── src
65
- └── components
66
- └── MyComponent
67
- ├── index.content.cjs # Content declaration file
68
- └── index.cjx
69
- ```
70
-
71
- ```bash codeFormat="json"
72
- .
73
- └── src
74
- └── components
75
- └── MyComponent
76
- ├── index.content.json # Content declaration file
77
- └── index.jsx
78
- ```
79
-
80
- 2. **Centralized Translations**
81
- A single content declaration file collects all necessary translations for a component, making missing translations easier to catch.
82
- With TypeScript, you even get compile-time errors if translations are missing.
83
-
84
- ## Installation
85
-
86
- In a Create React App project, install these dependencies:
87
-
88
- ```bash
89
- # With npm
90
- npm install intlayer react-i18next i18next i18next-resources-to-backend @intlayer/sync-json-plugin
48
+ <TOC/>
49
+
50
+ ## Step-by-Step Guide to Set Up Intlayer with react-i18next
51
+
52
+ ### Step 1: Install Dependencies
53
+
54
+ Install the necessary packages:
55
+
56
+ ```bash packageManager="npm"
57
+ npm install intlayer @intlayer/sync-json-plugin
91
58
  ```
92
59
 
93
- ```bash
94
- # With yarn
95
- yarn add intlayer react-i18next i18next i18next-resources-to-backend @intlayer/sync-json-plugin
60
+ ```bash packageManager="pnpm"
61
+ pnpm add intlayer @intlayer/sync-json-plugin
96
62
  ```
97
63
 
98
- ```bash
99
- # With pnpm
100
- pnpm add intlayer react-i18next i18next i18next-resources-to-backend @intlayer/sync-json-plugin
64
+ ```bash packageManager="yarn"
65
+ yarn add intlayer @intlayer/sync-json-plugin
101
66
  ```
102
67
 
103
- ### What Are These Packages?
68
+ **Package descriptions:**
69
+
70
+ - **intlayer**: Core library for internationalization management, content declaration, and building
71
+ - **@intlayer/sync-json-plugin**: Plugin to export Intlayer content declarations to react-i18next compatible JSON format
104
72
 
105
- - **intlayer** The CLI and core library for managing i18n configurations, content declarations, and building dictionary outputs.
106
- - **react-intlayer** – React-specific integration for Intlayer, providing notably some script to automate the build of dictionaries.
107
- - **react-i18next** – React-specific integration library for i18next, including the `useTranslation` hook.
108
- - **i18next** – The underlying framework for translation handling.
109
- - **i18next-resources-to-backend** – An i18next backend that dynamically imports JSON resources.
110
- - **@intlayer/sync-json-plugin** – A plugin for Intlayer that syncs JSON files to dictionaries.
73
+ ### Step 2: Implement the Intlayer plugin to wrap the JSON
111
74
 
112
- ## Configuring Intlayer to Export i18next Dictionaries
75
+ Create an Intlayer configuration file to define your supported locales:
113
76
 
114
- Create (or update) your `intlayer.config.ts` in the root of your project:
77
+ **If you want to also export JSON dictionaries for react-i18next**, add the `syncJSON` plugin:
115
78
 
116
- ```typescript title="intlayer.config.ts"
79
+ ```typescript fileName="intlayer.config.ts"
117
80
  import { Locales, type IntlayerConfig } from "intlayer";
81
+ import { syncJSON } from "@intlayer/sync-json-plugin";
118
82
 
119
83
  const config: IntlayerConfig = {
120
84
  internationalization: {
121
- // Add as many locales as you wish
122
85
  locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
123
86
  defaultLocale: Locales.ENGLISH,
124
87
  },
125
88
  plugins: [
126
89
  syncJSON({
127
- source: ({ key, locale }) => `./i18next/resources/${locale}/${key}.json`,
90
+ source: ({ key, locale }) => `./messages/${locale}/${key}.json`,
128
91
  }),
129
92
  ],
130
93
  };
@@ -132,221 +95,30 @@ const config: IntlayerConfig = {
132
95
  export default config;
133
96
  ```
134
97
 
135
- > **Note**: If you’re not using TypeScript, you can create this config file as `.cjs`, `.mjs`, or `.js` (see the [Intlayer docs](https://intlayer.org/en/doc/concept/configuration) for details).
136
-
137
- ## Building the i18next Resources
138
-
139
- Once your content declarations are in place (next section), run the **Intlayer build command**:
140
-
141
- ```bash
142
- # With npm
143
- npx run intlayer build
144
- ```
145
-
146
- ```bash
147
- # With yarn
148
- yarn intlayer build
149
- ```
150
-
151
- ```bash
152
- # With pnpm
153
- pnpm intlayer build
154
- ```
155
-
156
- > This will generate your i18next resources inside the `./i18next/resources` directory by default.
157
-
158
- A typical output might look like this:
159
-
160
- ```bash
161
- .
162
- └── i18next
163
- └── resources
164
- ├── en
165
- │ └── my-content.json
166
- ├── fr
167
- │ └── my-content.json
168
- └── es
169
- └── my-content.json
170
- ```
171
-
172
- Where each **Intlayer** declaration key is used as an **i18next namespace** (e.g., `my-content.json`).
173
-
174
- ## Importing Dictionaries into Your react-i18next Configuration
175
-
176
- To dynamically load these resources at runtime, use [`i18next-resources-to-backend`](https://www.npmjs.com/package/i18next-resources-to-backend). For instance, create an `i18n.ts` (or `.js`) file in your project:
177
-
178
- ```typescript title="i18n.ts"
179
- import i18next from "i18next";
180
- import { initReactI18next } from "react-i18next";
181
- import resourcesToBackend from "i18next-resources-to-backend";
182
-
183
- i18next
184
- // react-i18next plugin
185
- .use(initReactI18next)
186
- // dynamically load resources
187
- .use(
188
- resourcesToBackend((language: string, namespace: string) => {
189
- // Adjust the import path to your resources directory
190
- return import(`../i18next/resources/${language}/${namespace}.json`);
191
- })
192
- )
193
- // Initialize i18next
194
- .init({
195
- // Fallback locale
196
- fallbackLng: "en",
197
-
198
- // You can add other i18next config options here, see:
199
- // https://www.i18next.com/overview/configuration-options
200
- });
201
-
202
- export default i18next;
203
- ```
204
-
205
- ```javascript title="i18n.js"
206
- import i18next from "i18next";
207
- import { initReactI18next } from "react-i18next";
208
- import resourcesToBackend from "i18next-resources-to-backend";
209
-
210
- i18next
211
- .use(initReactI18next)
212
- .use(
213
- resourcesToBackend(
214
- (language, namespace) =>
215
- import(`../i18next/resources/${language}/${namespace}.json`)
216
- )
217
- )
218
- .init({
219
- fallbackLng: "en",
220
- });
221
-
222
- export default i18next;
223
- ```
224
-
225
- Then, in your **root** or **index** file (e.g., `src/index.tsx`), import this `i18n` setup **before** rendering the `App`:
226
-
227
- ```typescript
228
- import React from "react";
229
- import ReactDOM from "react-dom/client";
230
- // Initialize i18n before anything else
231
- import "./i18n";
232
- import App from "./App";
233
-
234
- ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
235
- <React.StrictMode>
236
- <App />
237
- </React.StrictMode>
238
- );
239
- ```
240
-
241
- ## Creating and Managing Your Dictionarys
242
-
243
- Intlayer extracts translations from “content declaration files” located anywhere under `./src` (by default).
244
- Here’s a minimal example in TypeScript:
245
-
246
- ```typescript title="src/components/MyComponent/MyComponent.content.ts"
247
- import { t, type Dictionary } from "intlayer";
248
-
249
- const content = {
250
- // The "key" will be your i18next namespace (e.g., "my-component")
251
- key: "my-component",
252
- content: {
253
- // Each "t" call is a separate translation node
254
- heading: t({
255
- en: "Hello World",
256
- es: "Hola Mundo",
257
- fr: "Bonjour le monde",
258
- }),
259
- description: t({
260
- en: "My i18n description text...",
261
- fr: "Ma description en i18n...",
262
- es: "Mi descripción en i18n...",
263
- }),
264
- },
265
- } satisfies Dictionary;
266
-
267
- export default content;
268
- ```
269
-
270
- If you prefer JSON, `.cjs`, or `.mjs`, refer to the [Intlayer docs](https://intlayer.org/en/doc/concept/content).
271
-
272
- > By default, valid content declarations match the file extension pattern:
98
+ The `syncJSON` plugin will automatically wrap the JSON. It will read and write the JSON files without changing the content architecture.
273
99
 
274
- > `*.content.{ts,tsx,js,jsx,mjs,mjx,cjs,cjx,json}`
100
+ If you want to make coexist that JSON with intlayer content declaration files (`.content` files), Intlayer will proceed this way:
275
101
 
276
- ## Using the Translations in React Components
102
+ 1. load both JSON and content declaration files and transform them into a intlayer dictionary.
103
+ 2. if there is conflicts between the JSON and the content declaration files, Intlayer will process to the merge of that all dictionaries. Depending of the priority of the plugins, and the one of the content declaration file (all are configurable).
277
104
 
278
- After you’ve **built** your Intlayer resources and configured react-i18next, you can directly use the `useTranslation` hook from **react-i18next**.
279
- For instance:
105
+ If changes are made using the CLI to translate the JSON, or using the CMS, Intlayer will update the JSON file with the new translations.
280
106
 
281
- ```tsx title="src/components/MyComponent/MyComponent.tsx"
282
- import type { FC } from "react";
283
- import { useTranslation } from "react-i18next";
107
+ To see more details about the `syncJSON` plugin, please refer to the [syncJSON plugin documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/plugins/sync-json.md).
284
108
 
285
- /**
286
- * The i18next "namespace" is the Intlayer `key` from "MyComponent.content.ts"
287
- * so we'll pass "my-component" to useTranslation().
288
- */
289
- const MyComponent: FC = () => {
290
- const { t } = useTranslation("my-component");
291
-
292
- return (
293
- <div>
294
- <h1>{t("heading")}</h1>
295
- <p>{t("description")}</p>
296
- </div>
297
- );
298
- };
299
-
300
- export default MyComponent;
301
- ```
302
-
303
- > Note that the `t` function references **keys** inside your generated JSON. For an Intlayer content entry named `heading`, you’ll use `t("heading")`.
304
-
305
- ## Optional: Integrate with Create React App Scripts (CRACO)
306
-
307
- **react-intlayer** provides a CRACO-based approach for custom builds and dev server configuration. If you want Intlayer’s build step integrated seamlessly, you can:
308
-
309
- 1. **Install react-intlayer** (if you haven’t):
310
- ```bash
311
- npm install react-intlayer --save-dev
312
- ```
313
- 2. **Adjust your `package.json` scripts** to use `react-intlayer` scripts:
314
-
315
- ```jsonc
316
- "scripts": {
317
- "start": "react-intlayer start",
318
- "build": "react-intlayer build",
319
- "transpile": "intlayer build"
320
- }
321
- ```
322
-
323
- > `react-intlayer` scripts are based on [CRACO](https://craco.js.org/). You can also implement your own setup based on the intlayer craco plugin. [See example here](https://github.com/aymericzip/intlayer/blob/main/examples/react-app/craco.config.js).
324
-
325
- Now, running `npm run build`, `yarn build`, or `pnpm build` triggers both Intlayer and CRA builds.
326
-
327
- ## TypeScript Configuration
109
+ ## Git Configuration
328
110
 
329
- **Intlayer** provides **autogenerated type definitions** for your content. To ensure TypeScript picks them up, add **`types`** (or `types` if you configured differently) to your `tsconfig.json` **include** array:
111
+ It's recommended to ignore auto-generated Intlayer files:
330
112
 
331
- ```json5 title="tsconfig.json"
332
- {
333
- "compilerOptions": {
334
- // ...
335
- },
336
- "include": ["src", "types"],
337
- }
113
+ ```plaintext fileName=".gitignore"
114
+ # Ignore files generated by Intlayer
115
+ .intlayer
338
116
  ```
339
117
 
340
- > This will let TypeScript infer the shape of your translations for better autocompletion and error detection.
118
+ These files can be regenerated during your build process and don't need to be committed to version control.
341
119
 
342
- ## Git Configuration
120
+ ### VS Code Extension
343
121
 
344
- It is recommended to **ignore** auto-generated files and folders from Intlayer. Add this line to your `.gitignore`:
345
-
346
- ```plaintext
347
- # Ignore the files generated by Intlayer
348
- .intlayer
349
- i18next
350
- ```
122
+ For improved developer experience, install the official **Intlayer VS Code Extension**:
351
123
 
352
- You typically do **not** commit these resources or `.intlayer` internal build artifacts, as they can be regenerated on each build.
124
+ [Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)