@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
@@ -0,0 +1,244 @@
1
+ ---
2
+ createdAt: 2025-03-13
3
+ updatedAt: 2025-10-05
4
+ title: Plugin Sync JSON
5
+ description: Synchronisez les dictionnaires Intlayer avec des fichiers JSON i18n tiers (i18next, next-intl, react-intl, vue-i18n, et plus). Conservez votre i18n existant tout en utilisant Intlayer pour gérer, traduire et tester vos messages.
6
+ keywords:
7
+ - Intlayer
8
+ - Sync JSON
9
+ - i18next
10
+ - next-intl
11
+ - react-intl
12
+ - vue-i18n
13
+ - next-translate
14
+ - nuxt-i18n
15
+ - LinguiJS
16
+ - Polyglot.js
17
+ - Solid-i18next
18
+ - svelte-i18n
19
+ - i18n
20
+ - traductions
21
+ slugs:
22
+ - doc
23
+ - plugin
24
+ - sync-json
25
+ history:
26
+ - version: 6.1.6
27
+ date: 2025-10-05
28
+ changes: Documentation initiale du plugin Sync JSON
29
+ ---
30
+
31
+ # Sync JSON (ponts i18n)
32
+
33
+ Utilisez Intlayer comme un complément à votre pile i18n existante. Ce plugin maintient vos messages JSON synchronisés avec les dictionnaires Intlayer afin que vous puissiez :
34
+
35
+ - Conserver i18next, next-intl, react-intl, vue-i18n, next-translate, nuxt-i18n, Solid-i18next, svelte-i18n, etc.
36
+ - Gérer et traduire vos messages avec Intlayer (CLI, CI, fournisseurs, CMS), sans refondre votre application.
37
+ - Publier des tutoriels et du contenu SEO ciblant chaque écosystème, tout en suggérant Intlayer comme couche de gestion JSON.
38
+
39
+ Notes et périmètre actuel :
40
+
41
+ - L'externalisation vers le CMS fonctionne pour les traductions et le texte classique.
42
+ - Pas encore de support pour les insertions, pluriels/ICU, ou les fonctionnalités avancées d'exécution d'autres bibliothèques.
43
+ - L'éditeur visuel n'est pas encore pris en charge pour les sorties i18n tierces.
44
+
45
+ ### Quand utiliser ce plugin
46
+
47
+ - Vous utilisez déjà une bibliothèque i18n et stockez les messages dans des fichiers JSON.
48
+ - Vous souhaitez un remplissage assisté par IA, des tests en CI, et des opérations de contenu sans changer votre runtime de rendu.
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ pnpm add -D @intlayer/sync-json-plugin
54
+ # ou
55
+ npm i -D @intlayer/sync-json-plugin
56
+ ```
57
+
58
+ ## Démarrage rapide
59
+
60
+ Ajoutez le plugin à votre `intlayer.config.ts` et pointez-le vers votre structure JSON existante.
61
+
62
+ ```ts fileName="intlayer.config.ts"
63
+ import { defineConfig, Locales } from "intlayer";
64
+ import { syncJSON } from "@intlayer/sync-json-plugin";
65
+
66
+ export default defineConfig({
67
+ internationalization: {
68
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
69
+ defaultLocale: Locales.ENGLISH,
70
+ },
71
+
72
+ // Gardez vos fichiers JSON actuels synchronisés avec les dictionnaires Intlayer
73
+ plugins: [
74
+ syncJSON({
75
+ // Mise en page par locale, par namespace (par exemple, next-intl, i18next avec namespaces)
76
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
77
+ }),
78
+ ],
79
+ });
80
+ ```
81
+
82
+ Alternative : un seul fichier par locale (courant avec les configurations i18next/react-intl) :
83
+
84
+ ```ts fileName="intlayer.config.ts"
85
+ plugins: [
86
+ syncJSON({
87
+ source: ({ locale }) => `./locales/${locale}.json`,
88
+ }),
89
+ ];
90
+ ```
91
+
92
+ ### Comment ça fonctionne
93
+
94
+ - Lecture : le plugin découvre les fichiers JSON à partir de votre générateur `source` et les charge comme des dictionnaires Intlayer.
95
+ - Écriture : après les builds et les remplissages, il écrit les JSON localisés aux mêmes emplacements (avec une nouvelle ligne finale pour éviter les problèmes de formatage).
96
+ - Auto‑remplissage : le plugin déclare un chemin `autoFill` pour chaque dictionnaire. L'exécution de `intlayer fill` met à jour uniquement les traductions manquantes dans vos fichiers JSON par défaut.
97
+
98
+ API :
99
+
100
+ ```ts
101
+ syncJSON({
102
+ source: ({ key, locale }) => string, // requis
103
+ location?: string, // étiquette optionnelle, par défaut : "plugin"
104
+ priority?: number, // priorité optionnelle pour la résolution des conflits, par défaut : 0
105
+ });
106
+ ```
107
+
108
+ ## Sources JSON multiples et priorité
109
+
110
+ Vous pouvez ajouter plusieurs plugins `syncJSON` pour synchroniser différentes sources JSON. Cela est utile lorsque vous avez plusieurs bibliothèques i18n ou différentes structures JSON dans votre projet.
111
+
112
+ ### Système de priorité
113
+
114
+ Lorsque plusieurs plugins ciblent la même clé de dictionnaire, le paramètre `priority` détermine quel plugin a la priorité :
115
+
116
+ - Les nombres de priorité plus élevés l'emportent sur les plus faibles
117
+ - La priorité par défaut des fichiers `.content` est `0`
118
+ - La priorité par défaut des fichiers de contenu des plugins est `-1`
119
+ - Les plugins avec la même priorité sont traités dans l'ordre où ils apparaissent dans la configuration
120
+
121
+ ```ts fileName="intlayer.config.ts"
122
+ import { defineConfig, Locales } from "intlayer";
123
+ import { syncJSON } from "@intlayer/sync-json-plugin";
124
+
125
+ export default defineConfig({
126
+ internationalization: {
127
+ locales: [Locales.ENGLISH, Locales.FRENCH],
128
+ defaultLocale: Locales.ENGLISH,
129
+ },
130
+
131
+ plugins: [
132
+ // Source JSON principale (priorité la plus élevée)
133
+ syncJSON({
134
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
135
+ location: "main-translations",
136
+ priority: 10,
137
+ }),
138
+
139
+ // Source JSON de secours (priorité plus basse)
140
+ syncJSON({
141
+ source: ({ locale }) => `./fallback-locales/${locale}.json`,
142
+ location: "fallback-translations",
143
+ priority: 5,
144
+ }),
145
+
146
+ // Source JSON héritée (priorité la plus basse)
147
+ syncJSON({
148
+ source: ({ locale }) => `/my/other/app/legacy/${locale}/messages.json`,
149
+ location: "legacy-translations",
150
+ priority: 1,
151
+ }),
152
+ ],
153
+ });
154
+ ```
155
+
156
+ ### Résolution des conflits
157
+
158
+ Lorsque la même clé de traduction existe dans plusieurs sources JSON :
159
+
160
+ 1. Le plugin avec la priorité la plus élevée détermine la valeur finale
161
+ 2. Les sources de priorité inférieure sont utilisées comme secours pour les clés manquantes
162
+ 3. Cela vous permet de maintenir les traductions héritées tout en migrant progressivement vers de nouvelles structures
163
+
164
+ ## Intégrations
165
+
166
+ Voici des mappages courants. Gardez votre runtime intact ; ajoutez uniquement le plugin.
167
+
168
+ ### i18next
169
+
170
+ Disposition typique des fichiers : `./public/locales/{locale}/{namespace}.json` ou `./locales/{locale}/{namespace}.json`.
171
+
172
+ ```ts fileName="intlayer.config.ts"
173
+ import { syncJSON } from "@intlayer/sync-json-plugin";
174
+
175
+ export default {
176
+ plugins: [
177
+ syncJSON({
178
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
179
+ }),
180
+ ],
181
+ };
182
+ ```
183
+
184
+ ### next-intl
185
+
186
+ Messages JSON par locale (souvent `./messages/{locale}.json`) ou par namespace.
187
+
188
+ ```ts fileName="intlayer.config.ts"
189
+ plugins: [
190
+ syncJSON({
191
+ source: ({ locale, key }) => `./messages/${locale}/${key}.json`,
192
+ }),
193
+ ];
194
+ ```
195
+
196
+ Voir aussi : `docs/fr/intlayer_with_next-intl.md`.
197
+
198
+ ### react-intl
199
+
200
+ Un seul JSON par locale est courant :
201
+
202
+ ```ts fileName="intlayer.config.ts"
203
+ plugins: [
204
+ syncJSON({
205
+ source: ({ locale }) => `./locales/${locale}.json`,
206
+ }),
207
+ ];
208
+ ```
209
+
210
+ ### vue-i18n
211
+
212
+ Soit un seul fichier par locale, soit par namespace :
213
+
214
+ ```ts fileName="intlayer.config.ts"
215
+ plugins: [
216
+ syncJSON({
217
+ source: ({ key, locale }) => `./src/locales/${locale}/${key}.json`,
218
+ }),
219
+ ];
220
+ ```
221
+
222
+ ## CLI
223
+
224
+ Les fichiers JSON synchronisés seront considérés comme d'autres fichiers `.content`. Cela signifie que toutes les commandes intlayer seront disponibles pour les fichiers JSON synchronisés. Cela inclut :
225
+
226
+ - `intlayer content test` pour tester s'il manque des traductions
227
+ - `intlayer content list` pour lister les fichiers JSON synchronisés
228
+ - `intlayer content fill` pour remplir les traductions manquantes
229
+ - `intlayer content push` pour pousser les fichiers JSON synchronisés
230
+ - `intlayer content pull` pour récupérer les fichiers JSON synchronisés
231
+
232
+ Voir [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_cli.md) pour plus de détails.
233
+
234
+ ## Limitations (actuelles)
235
+
236
+ - Pas de support pour les insertions ou les pluriels/ICU lors de la cible de bibliothèques tierces.
237
+ - L’éditeur visuel n’est pas encore disponible pour les environnements d’exécution non-Intlayer.
238
+ - Synchronisation JSON uniquement ; les formats de catalogue non JSON ne sont pas pris en charge.
239
+
240
+ ## Pourquoi c’est important
241
+
242
+ - Nous pouvons recommander des solutions i18n établies et positionner Intlayer comme un complément.
243
+ - Nous tirons parti de leur SEO/mots-clés avec des tutoriels qui se terminent en suggérant Intlayer pour gérer le JSON.
244
+ - Cela élargit le public cible, passant des « nouveaux projets » à « toute équipe utilisant déjà i18n ».
@@ -412,23 +412,6 @@ Le système effectue automatiquement :
412
412
 
413
413
  **Avant (v6) :**
414
414
 
415
- ````typescript
416
- export default {
417
- #### Correspondance de configuration
418
-
419
- | Configuration v6 | Configuration v7 |
420
- | -------------------------- | ---------------------------------------------------- |
421
- | `autoFill: xxx` | `fill: xxx` |
422
- | `prefixDefault: false` | `mode: 'prefix-no-default'` |
423
- | `prefixDefault: true` | `mode: 'prefix-all'` |
424
- | `noPrefix: true` | `mode: 'no-prefix'` |
425
- | `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
426
- | `serverSetCookie: 'never'` | `storage: false` ou supprimer le cookie du tableau storage |
427
-
428
- #### Exemple de migration
429
-
430
- **Avant (v6) :**
431
-
432
415
  ```typescript
433
416
  export default {
434
417
  middleware: {
@@ -440,7 +423,7 @@ export default {
440
423
  noPrefix: false,
441
424
  },
442
425
  };
443
- ````
426
+ ```
444
427
 
445
428
  **Après (v7) :**
446
429
 
@@ -270,7 +270,7 @@ const LocaleLayout = async ({ children, params: { locale } }) => {
270
270
  export default LocaleLayout;
271
271
  ```
272
272
 
273
- ````jsx fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
273
+ ```jsx fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
274
274
  const { Inter } = require("next/font/google");
275
275
  const { getHTMLTextDir } = require("intlayer");
276
276
 
@@ -287,6 +287,7 @@ const LocaleLayout = async ({ children, params: { locale } }) => {
287
287
  };
288
288
 
289
289
  module.exports = LocaleLayout;
290
+ ```
290
291
 
291
292
  > इस चरण में, आपको त्रुटि का सामना करना पड़ेगा: `Error: Missing <html> and <body> tags in the root layout.`। यह अपेक्षित है क्योंकि `/app/page.tsx` फ़ाइल अब उपयोग में नहीं है और इसे हटा दिया जा सकता है। इसके बजाय, `[locale]` पाथ सेगमेंट `/app/[locale]/page.tsx` पेज को सक्रिय करेगा। परिणामस्वरूप, आपके ब्राउज़र में पेज `/en`, `/fr`, `/es` जैसे पाथ के माध्यम से सुलभ होंगे। डिफ़ॉल्ट लोकल को रूट पेज के रूप में सेट करने के लिए, चरण 7 में `proxy` सेटअप को देखें।
292
293
 
@@ -300,7 +301,7 @@ const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
300
301
  };
301
302
 
302
303
  export default LocaleLayout;
303
- ````
304
+ ```
304
305
 
305
306
  ```jsx {1} fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
306
307
  export { generateStaticParams } from "next-intlayer"; // सम्मिलित करने के लिए पंक्ति
@@ -0,0 +1,244 @@
1
+ ---
2
+ createdAt: 2025-03-13
3
+ updatedAt: 2025-10-05
4
+ title: सिंक JSON प्लगइन
5
+ description: Intlayer शब्दकोशों को तृतीय-पक्ष i18n JSON फ़ाइलों (i18next, next-intl, react-intl, vue-i18n, और अन्य) के साथ सिंक्रनाइज़ करें। अपने मौजूदा i18n को बनाए रखें जबकि Intlayer का उपयोग करके अपने संदेशों का प्रबंधन, अनुवाद और परीक्षण करें।
6
+ keywords:
7
+ - Intlayer
8
+ - सिंक JSON
9
+ - i18next
10
+ - next-intl
11
+ - react-intl
12
+ - vue-i18n
13
+ - next-translate
14
+ - nuxt-i18n
15
+ - LinguiJS
16
+ - Polyglot.js
17
+ - Solid-i18next
18
+ - svelte-i18n
19
+ - i18n
20
+ - अनुवाद
21
+ slugs:
22
+ - doc
23
+ - plugin
24
+ - sync-json
25
+ history:
26
+ - version: 6.1.6
27
+ date: 2025-10-05
28
+ changes: प्रारंभिक सिंक JSON प्लगइन दस्तावेज़ीकरण
29
+ ---
30
+
31
+ ## सिंक JSON (i18n ब्रिजेस)
32
+
33
+ अपने मौजूदा i18n स्टैक में एक ऐड-ऑन के रूप में Intlayer का उपयोग करें। यह प्लगइन आपके JSON संदेशों को Intlayer शब्दकोशों के साथ सिंक्रनाइज़ रखता है ताकि आप:
34
+
35
+ - i18next, next-intl, react-intl, vue-i18n, next-translate, nuxt-i18n, Solid-i18next, svelte-i18n आदि को बनाए रख सकें।
36
+ - अपने ऐप को पुनः संरचित किए बिना Intlayer (CLI, CI, प्रदाता, CMS) के साथ अपने संदेशों का प्रबंधन और अनुवाद कर सकें।
37
+ - प्रत्येक इकोसिस्टम को लक्षित करते हुए ट्यूटोरियल और SEO सामग्री वितरित करें, साथ ही JSON प्रबंधन परत के रूप में Intlayer का सुझाव दें।
38
+
39
+ नोट्स और वर्तमान दायरा:
40
+
41
+ - CMS के लिए बाहरीकरण अनुवादों और क्लासिक टेक्स्ट के लिए काम करता है।
42
+ - अभी तक सम्मिलन, बहुवचन/ICU, या अन्य लाइब्रेरी के उन्नत रनटाइम फीचर्स के लिए समर्थन नहीं है।
43
+ - तीसरे पक्ष के i18n आउटपुट के लिए विज़ुअल एडिटर अभी समर्थित नहीं है।
44
+
45
+ ### इस प्लगइन का उपयोग कब करें
46
+
47
+ - आप पहले से ही एक i18n लाइब्रेरी का उपयोग करते हैं और संदेशों को JSON फ़ाइलों में संग्रहीत करते हैं।
48
+ - आप AI-सहायता प्राप्त भराई, CI में परीक्षण, और कंटेंट ऑप्स चाहते हैं बिना अपने रेंडरिंग रनटाइम को बदले।
49
+
50
+ ## स्थापना
51
+
52
+ ```bash
53
+ pnpm add -D @intlayer/sync-json-plugin
54
+ # या
55
+ npm i -D @intlayer/sync-json-plugin
56
+ ```
57
+
58
+ ## त्वरित शुरुआत
59
+
60
+ अपने `intlayer.config.ts` में प्लगइन जोड़ें और इसे अपनी मौजूदा JSON संरचना की ओर इंगित करें।
61
+
62
+ ```ts fileName="intlayer.config.ts"
63
+ import { defineConfig, Locales } from "intlayer";
64
+ import { syncJSON } from "@intlayer/sync-json-plugin";
65
+
66
+ export default defineConfig({
67
+ internationalization: {
68
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
69
+ defaultLocale: Locales.ENGLISH,
70
+ },
71
+
72
+ // अपने वर्तमान JSON फ़ाइलों को Intlayer शब्दकोशों के साथ सिंक में रखें
73
+ plugins: [
74
+ syncJSON({
75
+ // प्रति-लोकल, प्रति-नेमस्पेस लेआउट (जैसे, next-intl, i18next नेमस्पेस के साथ)
76
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
77
+ }),
78
+ ],
79
+ });
80
+ ```
81
+
82
+ वैकल्पिक: प्रति-लोकल एकल फ़ाइल (i18next/react-intl सेटअप में सामान्य):
83
+
84
+ ```ts fileName="intlayer.config.ts"
85
+ plugins: [
86
+ syncJSON({
87
+ source: ({ locale }) => `./locales/${locale}.json`,
88
+ }),
89
+ ];
90
+ ```
91
+
92
+ ### यह कैसे काम करता है
93
+
94
+ - पढ़ें: प्लगइन आपके `source` बिल्डर से JSON फ़ाइलों को खोजता है और उन्हें Intlayer शब्दकोश के रूप में लोड करता है।
95
+ - लिखें: बिल्ड और भराई के बाद, यह स्थानीयकृत JSON को उसी पथों पर वापस लिखता है (फॉर्मेटिंग समस्याओं से बचने के लिए अंतिम नई लाइन के साथ)।
96
+ - ऑटो-फिल: प्लगइन प्रत्येक शब्दकोश के लिए एक `autoFill` पथ घोषित करता है। डिफ़ॉल्ट रूप से, `intlayer fill` चलाने पर आपकी JSON फ़ाइलों में केवल गायब अनुवाद अपडेट होते हैं।
97
+
98
+ API:
99
+
100
+ ```ts
101
+ syncJSON({
102
+ source: ({ key, locale }) => string, // आवश्यक
103
+ location?: string, // वैकल्पिक लेबल, डिफ़ॉल्ट: "plugin"
104
+ priority?: number, // संघर्ष समाधान के लिए वैकल्पिक प्राथमिकता, डिफ़ॉल्ट: 0
105
+ });
106
+ ```
107
+
108
+ ## कई JSON स्रोत और प्राथमिकता
109
+
110
+ आप विभिन्न JSON स्रोतों को सिंक्रनाइज़ करने के लिए कई `syncJSON` प्लगइन्स जोड़ सकते हैं। यह तब उपयोगी होता है जब आपके प्रोजेक्ट में कई i18n लाइब्रेरीज़ या विभिन्न JSON संरचनाएँ हों।
111
+
112
+ ### प्राथमिकता प्रणाली
113
+
114
+ जब कई प्लगइन्स एक ही शब्दकोश कुंजी को लक्षित करते हैं, तो `priority` पैरामीटर यह निर्धारित करता है कि कौन सा प्लगइन प्राथमिकता प्राप्त करेगा:
115
+
116
+ - उच्च प्राथमिकता संख्या निम्न प्राथमिकता वाले पर जीतती है
117
+ - `.content` फ़ाइलों की डिफ़ॉल्ट प्राथमिकता `0` है
118
+ - प्लगइन्स की सामग्री फ़ाइलों की डिफ़ॉल्ट प्राथमिकता `-1` है
119
+ - समान प्राथमिकता वाले प्लगइन्स को कॉन्फ़िगरेशन में उनके प्रकट होने के क्रम में संसाधित किया जाता है
120
+
121
+ ```ts fileName="intlayer.config.ts"
122
+ import { defineConfig, Locales } from "intlayer";
123
+ import { syncJSON } from "@intlayer/sync-json-plugin";
124
+
125
+ export default defineConfig({
126
+ internationalization: {
127
+ locales: [Locales.ENGLISH, Locales.FRENCH],
128
+ defaultLocale: Locales.ENGLISH,
129
+ },
130
+
131
+ plugins: [
132
+ // प्राथमिक JSON स्रोत (सबसे उच्च प्राथमिकता)
133
+ syncJSON({
134
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
135
+ location: "main-translations",
136
+ priority: 10,
137
+ }),
138
+
139
+ // फॉलबैक JSON स्रोत (कम प्राथमिकता)
140
+ syncJSON({
141
+ source: ({ locale }) => `./fallback-locales/${locale}.json`,
142
+ location: "fallback-translations",
143
+ priority: 5,
144
+ }),
145
+
146
+ // लेगेसी JSON स्रोत (सबसे कम प्राथमिकता)
147
+ syncJSON({
148
+ source: ({ locale }) => `/my/other/app/legacy/${locale}/messages.json`,
149
+ location: "legacy-translations",
150
+ priority: 1,
151
+ }),
152
+ ],
153
+ });
154
+ ```
155
+
156
+ ### संघर्ष समाधान
157
+
158
+ जब एक ही अनुवाद कुंजी कई JSON स्रोतों में मौजूद होती है:
159
+
160
+ 1. सबसे उच्च प्राथमिकता वाला प्लगइन अंतिम मान निर्धारित करता है
161
+ 2. कम प्राथमिकता वाले स्रोत गायब कुंजी के लिए फॉलबैक के रूप में उपयोग किए जाते हैं
162
+ 3. यह आपको लेगेसी अनुवाद बनाए रखने की अनुमति देता है जबकि आप धीरे-धीरे नए संरचनाओं में माइग्रेट कर रहे होते हैं
163
+
164
+ ## एकीकरण
165
+
166
+ नीचे सामान्य मैपिंग दी गई हैं। अपने रनटाइम को बिना छुए रखें; केवल प्लगइन जोड़ें।
167
+
168
+ ### i18next
169
+
170
+ सामान्य फ़ाइल लेआउट: `./public/locales/{locale}/{namespace}.json` या `./locales/{locale}/{namespace}.json`।
171
+
172
+ ```ts fileName="intlayer.config.ts"
173
+ import { syncJSON } from "@intlayer/sync-json-plugin";
174
+
175
+ export default {
176
+ plugins: [
177
+ syncJSON({
178
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
179
+ }),
180
+ ],
181
+ };
182
+ ```
183
+
184
+ ### next-intl
185
+
186
+ प्रति-लोकल JSON संदेश (अक्सर `./messages/{locale}.json`) या प्रति-नेमस्पेस।
187
+
188
+ ```ts fileName="intlayer.config.ts"
189
+ plugins: [
190
+ syncJSON({
191
+ source: ({ locale, key }) => `./messages/${locale}/${key}.json`,
192
+ }),
193
+ ];
194
+ ```
195
+
196
+ देखें: `docs/hi/intlayer_with_next-intl.md`।
197
+
198
+ ### react-intl
199
+
200
+ प्रति लोकल एकल JSON सामान्य है:
201
+
202
+ ```ts fileName="intlayer.config.ts"
203
+ plugins: [
204
+ syncJSON({
205
+ source: ({ locale }) => `./locales/${locale}.json`,
206
+ }),
207
+ ];
208
+ ```
209
+
210
+ ### vue-i18n
211
+
212
+ प्रति-लोकल या प्रति-नेमस्पेस एकल फ़ाइल हो सकती है:
213
+
214
+ ```ts fileName="intlayer.config.ts"
215
+ plugins: [
216
+ syncJSON({
217
+ source: ({ key, locale }) => `./src/locales/${locale}/${key}.json`,
218
+ }),
219
+ ];
220
+ ```
221
+
222
+ ## CLI
223
+
224
+ सिंक किए गए JSON फ़ाइलों को अन्य `.content` फ़ाइलों के रूप में माना जाएगा। इसका मतलब है कि सभी intlayer कमांड सिंक किए गए JSON फ़ाइलों के लिए उपलब्ध होंगे। जिनमें शामिल हैं:
225
+
226
+ - `intlayer content test` यह जांचने के लिए कि क्या कोई अनुवाद गायब है
227
+ - `intlayer content list` सिंक किए गए JSON फ़ाइलों की सूची बनाने के लिए
228
+ - `intlayer content fill` गायब अनुवाद भरने के लिए
229
+ - `intlayer content push` सिंक किए गए JSON फ़ाइलों को पुश करने के लिए
230
+ - `intlayer content pull` सिंक किए गए JSON फ़ाइलों को पुल करने के लिए
231
+
232
+ अधिक जानकारी के लिए [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_cli.md) देखें।
233
+
234
+ ## सीमाएँ (वर्तमान)
235
+
236
+ - तृतीय-पक्ष लाइब्रेरीज़ को लक्षित करते समय कोई सम्मिलन या बहुवचन/ICU समर्थन नहीं।
237
+ - गैर-Intlayer रनटाइम के लिए विज़ुअल एडिटर अभी उपलब्ध नहीं है।
238
+ - केवल JSON सिंक्रनाइज़ेशन; गैर-JSON कैटलॉग प्रारूप समर्थित नहीं हैं।
239
+
240
+ ## यह क्यों महत्वपूर्ण है
241
+
242
+ - हम स्थापित i18n समाधानों की सिफारिश कर सकते हैं और Intlayer को एक ऐड-ऑन के रूप में स्थिति दे सकते हैं।
243
+ - हम उनके SEO/कीवर्ड का उपयोग ट्यूटोरियल के साथ करते हैं जो अंत में JSON प्रबंधन के लिए Intlayer सुझाते हैं।
244
+ - यह लक्षित दर्शकों का विस्तार करता है, "नए प्रोजेक्ट्स" से लेकर "कोई भी टीम जो पहले से i18n का उपयोग कर रही है" तक।