@intlayer/docs 7.0.4-canary.0 → 7.0.5
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/ar/intlayer_with_i18next.md +68 -106
- package/blog/ar/intlayer_with_next-i18next.md +84 -288
- package/blog/ar/intlayer_with_next-intl.md +58 -337
- package/blog/ar/intlayer_with_react-i18next.md +68 -290
- package/blog/ar/intlayer_with_react-intl.md +63 -266
- package/blog/de/intlayer_with_i18next.md +77 -97
- package/blog/de/intlayer_with_next-i18next.md +69 -296
- package/blog/de/intlayer_with_next-intl.md +59 -340
- package/blog/de/intlayer_with_react-i18next.md +68 -290
- package/blog/de/intlayer_with_react-intl.md +62 -264
- package/blog/en/intlayer_with_i18next.md +36 -1638
- package/blog/en/intlayer_with_next-i18next.md +22 -847
- package/blog/en/intlayer_with_next-intl.md +32 -1053
- package/blog/en/intlayer_with_react-i18next.md +38 -764
- package/blog/en/intlayer_with_react-intl.md +42 -1018
- package/blog/en-GB/intlayer_with_i18next.md +67 -103
- package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
- package/blog/en-GB/intlayer_with_next-intl.md +58 -337
- package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
- package/blog/en-GB/intlayer_with_react-intl.md +61 -264
- package/blog/es/intlayer_with_i18next.md +67 -103
- package/blog/es/intlayer_with_next-i18next.md +71 -296
- package/blog/es/intlayer_with_next-intl.md +57 -338
- package/blog/es/intlayer_with_react-i18next.md +68 -290
- package/blog/es/intlayer_with_react-intl.md +62 -265
- package/blog/fr/intlayer_with_i18next.md +66 -104
- package/blog/fr/intlayer_with_next-i18next.md +82 -285
- package/blog/fr/intlayer_with_next-intl.md +57 -338
- package/blog/fr/intlayer_with_react-i18next.md +67 -289
- package/blog/fr/intlayer_with_react-intl.md +61 -264
- package/blog/hi/intlayer_with_i18next.md +68 -104
- package/blog/hi/intlayer_with_next-i18next.md +74 -299
- package/blog/hi/intlayer_with_next-intl.md +57 -239
- package/blog/hi/intlayer_with_react-i18next.md +69 -291
- package/blog/hi/intlayer_with_react-intl.md +65 -268
- package/blog/id/intlayer_with_i18next.md +126 -0
- package/blog/id/intlayer_with_next-i18next.md +142 -0
- package/blog/id/intlayer_with_next-intl.md +113 -0
- package/blog/id/intlayer_with_react-i18next.md +124 -0
- package/blog/id/intlayer_with_react-intl.md +122 -0
- package/blog/it/intlayer_with_i18next.md +67 -103
- package/blog/it/intlayer_with_next-i18next.md +71 -296
- package/blog/it/intlayer_with_next-intl.md +57 -338
- package/blog/it/intlayer_with_react-i18next.md +68 -290
- package/blog/it/intlayer_with_react-intl.md +62 -265
- package/blog/ja/intlayer_with_i18next.md +68 -103
- package/blog/ja/intlayer_with_next-i18next.md +85 -283
- package/blog/ja/intlayer_with_next-intl.md +58 -336
- package/blog/ja/intlayer_with_react-i18next.md +68 -290
- package/blog/ja/intlayer_with_react-intl.md +62 -264
- package/blog/ko/intlayer_with_i18next.md +80 -96
- package/blog/ko/intlayer_with_next-i18next.md +85 -287
- package/blog/ko/intlayer_with_next-intl.md +68 -327
- package/blog/ko/intlayer_with_react-i18next.md +68 -290
- package/blog/ko/intlayer_with_react-intl.md +64 -266
- package/blog/pl/intlayer_with_i18next.md +126 -0
- package/blog/pl/intlayer_with_next-i18next.md +142 -0
- package/blog/pl/intlayer_with_next-intl.md +111 -0
- package/blog/pl/intlayer_with_react-i18next.md +124 -0
- package/blog/pl/intlayer_with_react-intl.md +122 -0
- package/blog/pt/intlayer_with_i18next.md +67 -103
- package/blog/pt/intlayer_with_next-i18next.md +72 -293
- package/blog/pt/intlayer_with_next-intl.md +57 -256
- package/blog/pt/intlayer_with_react-i18next.md +104 -78
- package/blog/pt/intlayer_with_react-intl.md +62 -266
- package/blog/ru/intlayer_with_i18next.md +66 -104
- package/blog/ru/intlayer_with_next-i18next.md +71 -296
- package/blog/ru/intlayer_with_next-intl.md +58 -337
- package/blog/ru/intlayer_with_react-i18next.md +68 -290
- package/blog/ru/intlayer_with_react-intl.md +62 -265
- package/blog/tr/intlayer_with_i18next.md +71 -107
- package/blog/tr/intlayer_with_next-i18next.md +72 -297
- package/blog/tr/intlayer_with_next-intl.md +58 -339
- package/blog/tr/intlayer_with_react-i18next.md +69 -291
- package/blog/tr/intlayer_with_react-intl.md +63 -285
- package/blog/vi/intlayer_with_i18next.md +126 -0
- package/blog/vi/intlayer_with_next-i18next.md +142 -0
- package/blog/vi/intlayer_with_next-intl.md +111 -0
- package/blog/vi/intlayer_with_react-i18next.md +124 -0
- package/blog/vi/intlayer_with_react-intl.md +122 -0
- package/blog/zh/intlayer_with_i18next.md +67 -102
- package/blog/zh/intlayer_with_next-i18next.md +72 -296
- package/blog/zh/intlayer_with_next-intl.md +58 -336
- package/blog/zh/intlayer_with_react-i18next.md +68 -290
- package/blog/zh/intlayer_with_react-intl.md +63 -106
- package/docs/ar/plugins/sync-json.md +244 -0
- package/docs/de/plugins/sync-json.md +244 -0
- package/docs/en/intlayer_cli.md +25 -0
- package/docs/en/intlayer_with_nextjs_14.md +2 -0
- package/docs/en/intlayer_with_nextjs_15.md +2 -0
- package/docs/en/intlayer_with_nextjs_16.md +2 -0
- package/docs/en/plugins/sync-json.md +1 -1
- package/docs/en-GB/plugins/sync-json.md +244 -0
- package/docs/es/plugins/sync-json.md +244 -0
- package/docs/fr/plugins/sync-json.md +244 -0
- package/docs/hi/plugins/sync-json.md +244 -0
- package/docs/id/plugins/sync-json.md +244 -0
- package/docs/it/plugins/sync-json.md +244 -0
- package/docs/ja/plugins/sync-json.md +244 -0
- package/docs/ko/plugins/sync-json.md +244 -0
- package/docs/pl/plugins/sync-json.md +244 -0
- package/docs/pt/plugins/sync-json.md +244 -0
- package/docs/ru/plugins/sync-json.md +244 -0
- package/docs/tr/plugins/sync-json.md +245 -0
- package/docs/vi/plugins/sync-json.md +244 -0
- package/docs/zh/plugins/sync-json.md +244 -0
- package/package.json +14 -14
|
@@ -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 ».
|
|
@@ -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 का उपयोग कर रही है" तक।
|