@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.
Files changed (107) 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 +36 -1638
  12. package/blog/en/intlayer_with_next-i18next.md +22 -847
  13. package/blog/en/intlayer_with_next-intl.md +32 -1053
  14. package/blog/en/intlayer_with_react-i18next.md +38 -764
  15. package/blog/en/intlayer_with_react-intl.md +42 -1018
  16. package/blog/en-GB/intlayer_with_i18next.md +67 -103
  17. package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
  18. package/blog/en-GB/intlayer_with_next-intl.md +58 -337
  19. package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
  20. package/blog/en-GB/intlayer_with_react-intl.md +61 -264
  21. package/blog/es/intlayer_with_i18next.md +67 -103
  22. package/blog/es/intlayer_with_next-i18next.md +71 -296
  23. package/blog/es/intlayer_with_next-intl.md +57 -338
  24. package/blog/es/intlayer_with_react-i18next.md +68 -290
  25. package/blog/es/intlayer_with_react-intl.md +62 -265
  26. package/blog/fr/intlayer_with_i18next.md +66 -104
  27. package/blog/fr/intlayer_with_next-i18next.md +82 -285
  28. package/blog/fr/intlayer_with_next-intl.md +57 -338
  29. package/blog/fr/intlayer_with_react-i18next.md +67 -289
  30. package/blog/fr/intlayer_with_react-intl.md +61 -264
  31. package/blog/hi/intlayer_with_i18next.md +68 -104
  32. package/blog/hi/intlayer_with_next-i18next.md +74 -299
  33. package/blog/hi/intlayer_with_next-intl.md +57 -239
  34. package/blog/hi/intlayer_with_react-i18next.md +69 -291
  35. package/blog/hi/intlayer_with_react-intl.md +65 -268
  36. package/blog/id/intlayer_with_i18next.md +126 -0
  37. package/blog/id/intlayer_with_next-i18next.md +142 -0
  38. package/blog/id/intlayer_with_next-intl.md +113 -0
  39. package/blog/id/intlayer_with_react-i18next.md +124 -0
  40. package/blog/id/intlayer_with_react-intl.md +122 -0
  41. package/blog/it/intlayer_with_i18next.md +67 -103
  42. package/blog/it/intlayer_with_next-i18next.md +71 -296
  43. package/blog/it/intlayer_with_next-intl.md +57 -338
  44. package/blog/it/intlayer_with_react-i18next.md +68 -290
  45. package/blog/it/intlayer_with_react-intl.md +62 -265
  46. package/blog/ja/intlayer_with_i18next.md +68 -103
  47. package/blog/ja/intlayer_with_next-i18next.md +85 -283
  48. package/blog/ja/intlayer_with_next-intl.md +58 -336
  49. package/blog/ja/intlayer_with_react-i18next.md +68 -290
  50. package/blog/ja/intlayer_with_react-intl.md +62 -264
  51. package/blog/ko/intlayer_with_i18next.md +80 -96
  52. package/blog/ko/intlayer_with_next-i18next.md +85 -287
  53. package/blog/ko/intlayer_with_next-intl.md +68 -327
  54. package/blog/ko/intlayer_with_react-i18next.md +68 -290
  55. package/blog/ko/intlayer_with_react-intl.md +64 -266
  56. package/blog/pl/intlayer_with_i18next.md +126 -0
  57. package/blog/pl/intlayer_with_next-i18next.md +142 -0
  58. package/blog/pl/intlayer_with_next-intl.md +111 -0
  59. package/blog/pl/intlayer_with_react-i18next.md +124 -0
  60. package/blog/pl/intlayer_with_react-intl.md +122 -0
  61. package/blog/pt/intlayer_with_i18next.md +67 -103
  62. package/blog/pt/intlayer_with_next-i18next.md +72 -293
  63. package/blog/pt/intlayer_with_next-intl.md +57 -256
  64. package/blog/pt/intlayer_with_react-i18next.md +104 -78
  65. package/blog/pt/intlayer_with_react-intl.md +62 -266
  66. package/blog/ru/intlayer_with_i18next.md +66 -104
  67. package/blog/ru/intlayer_with_next-i18next.md +71 -296
  68. package/blog/ru/intlayer_with_next-intl.md +58 -337
  69. package/blog/ru/intlayer_with_react-i18next.md +68 -290
  70. package/blog/ru/intlayer_with_react-intl.md +62 -265
  71. package/blog/tr/intlayer_with_i18next.md +71 -107
  72. package/blog/tr/intlayer_with_next-i18next.md +72 -297
  73. package/blog/tr/intlayer_with_next-intl.md +58 -339
  74. package/blog/tr/intlayer_with_react-i18next.md +69 -291
  75. package/blog/tr/intlayer_with_react-intl.md +63 -285
  76. package/blog/vi/intlayer_with_i18next.md +126 -0
  77. package/blog/vi/intlayer_with_next-i18next.md +142 -0
  78. package/blog/vi/intlayer_with_next-intl.md +111 -0
  79. package/blog/vi/intlayer_with_react-i18next.md +124 -0
  80. package/blog/vi/intlayer_with_react-intl.md +122 -0
  81. package/blog/zh/intlayer_with_i18next.md +67 -102
  82. package/blog/zh/intlayer_with_next-i18next.md +72 -296
  83. package/blog/zh/intlayer_with_next-intl.md +58 -336
  84. package/blog/zh/intlayer_with_react-i18next.md +68 -290
  85. package/blog/zh/intlayer_with_react-intl.md +63 -106
  86. package/docs/ar/plugins/sync-json.md +244 -0
  87. package/docs/de/plugins/sync-json.md +244 -0
  88. package/docs/en/intlayer_cli.md +25 -0
  89. package/docs/en/intlayer_with_nextjs_14.md +2 -0
  90. package/docs/en/intlayer_with_nextjs_15.md +2 -0
  91. package/docs/en/intlayer_with_nextjs_16.md +2 -0
  92. package/docs/en/plugins/sync-json.md +1 -1
  93. package/docs/en-GB/plugins/sync-json.md +244 -0
  94. package/docs/es/plugins/sync-json.md +244 -0
  95. package/docs/fr/plugins/sync-json.md +244 -0
  96. package/docs/hi/plugins/sync-json.md +244 -0
  97. package/docs/id/plugins/sync-json.md +244 -0
  98. package/docs/it/plugins/sync-json.md +244 -0
  99. package/docs/ja/plugins/sync-json.md +244 -0
  100. package/docs/ko/plugins/sync-json.md +244 -0
  101. package/docs/pl/plugins/sync-json.md +244 -0
  102. package/docs/pt/plugins/sync-json.md +244 -0
  103. package/docs/ru/plugins/sync-json.md +244 -0
  104. package/docs/tr/plugins/sync-json.md +245 -0
  105. package/docs/vi/plugins/sync-json.md +244 -0
  106. package/docs/zh/plugins/sync-json.md +244 -0
  107. package/package.json +14 -14
@@ -0,0 +1,244 @@
1
+ ---
2
+ createdAt: 2025-03-13
3
+ updatedAt: 2025-10-05
4
+ title: Plugin Sinkronisasi JSON
5
+ description: Sinkronkan kamus Intlayer dengan file JSON i18n pihak ketiga (i18next, next-intl, react-intl, vue-i18n, dan lainnya). Pertahankan i18n Anda yang sudah ada sambil menggunakan Intlayer untuk mengelola, menerjemahkan, dan menguji pesan Anda.
6
+ keywords:
7
+ - Intlayer
8
+ - Sinkronisasi 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
+ - terjemahan
21
+ slugs:
22
+ - doc
23
+ - plugin
24
+ - sync-json
25
+ history:
26
+ - version: 6.1.6
27
+ date: 2025-10-05
28
+ changes: Dokumentasi awal plugin Sinkronisasi JSON
29
+ ---
30
+
31
+ # Sinkronisasi JSON (jembatan i18n)
32
+
33
+ Gunakan Intlayer sebagai tambahan pada tumpukan i18n Anda yang sudah ada. Plugin ini menjaga pesan JSON Anda tetap sinkron dengan kamus Intlayer sehingga Anda dapat:
34
+
35
+ - Mempertahankan i18next, next-intl, react-intl, vue-i18n, next-translate, nuxt-i18n, Solid-i18next, svelte-i18n, dll.
36
+ - Mengelola dan menerjemahkan pesan Anda dengan Intlayer (CLI, CI, penyedia, CMS), tanpa perlu merombak aplikasi Anda.
37
+ - Mengirimkan tutorial dan konten SEO yang menargetkan setiap ekosistem, sambil menyarankan Intlayer sebagai lapisan pengelolaan JSON.
38
+
39
+ Catatan dan cakupan saat ini:
40
+
41
+ - Eksternalisasi ke CMS berfungsi untuk terjemahan dan teks klasik.
42
+ - Belum mendukung penyisipan, bentuk jamak/ICU, atau fitur runtime lanjutan dari pustaka lain.
43
+ - Editor visual belum didukung untuk output i18n pihak ketiga.
44
+
45
+ ### Kapan menggunakan plugin ini
46
+
47
+ - Anda sudah menggunakan perpustakaan i18n dan menyimpan pesan dalam file JSON.
48
+ - Anda menginginkan pengisian berbantuan AI, pengujian di CI, dan operasi konten tanpa mengubah runtime rendering Anda.
49
+
50
+ ## Instalasi
51
+
52
+ ```bash
53
+ pnpm add -D @intlayer/sync-json-plugin
54
+ # atau
55
+ npm i -D @intlayer/sync-json-plugin
56
+ ```
57
+
58
+ ## Mulai cepat
59
+
60
+ Tambahkan plugin ke `intlayer.config.ts` Anda dan arahkan ke struktur JSON yang sudah ada.
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
+ // Jaga file JSON Anda saat ini tetap sinkron dengan kamus Intlayer
73
+ plugins: [
74
+ syncJSON({
75
+ // Tata letak per-locale, per-namespace (misalnya, next-intl, i18next dengan namespaces)
76
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
77
+ }),
78
+ ],
79
+ });
80
+ ```
81
+
82
+ Alternatif: satu file per locale (umum dengan pengaturan 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
+ ### Cara kerjanya
93
+
94
+ - Baca: plugin menemukan file JSON dari pembangun `source` Anda dan memuatnya sebagai kamus Intlayer.
95
+ - Tulis: setelah proses build dan pengisian, plugin menulis kembali JSON yang sudah dilokalkan ke jalur yang sama (dengan newline akhir untuk menghindari masalah format).
96
+ - Auto‑fill: plugin mendeklarasikan jalur `autoFill` untuk setiap kamus. Menjalankan `intlayer fill` secara default hanya memperbarui terjemahan yang hilang dalam file JSON Anda.
97
+
98
+ API:
99
+
100
+ ```ts
101
+ syncJSON({
102
+ source: ({ key, locale }) => string, // wajib
103
+ location?: string, // label opsional, default: "plugin"
104
+ priority?: number, // prioritas opsional untuk resolusi konflik, default: 0
105
+ });
106
+ ```
107
+
108
+ ## Beberapa sumber JSON dan prioritas
109
+
110
+ Anda dapat menambahkan beberapa plugin `syncJSON` untuk menyinkronkan berbagai sumber JSON. Ini berguna ketika Anda memiliki beberapa pustaka i18n atau struktur JSON yang berbeda dalam proyek Anda.
111
+
112
+ ### Sistem prioritas
113
+
114
+ Ketika beberapa plugin menargetkan kunci kamus yang sama, parameter `priority` menentukan plugin mana yang diutamakan:
115
+
116
+ - Angka prioritas yang lebih tinggi menang atas yang lebih rendah
117
+ - Prioritas default untuk file `.content` adalah `0`
118
+ - Prioritas default untuk file konten plugin adalah `-1`
119
+ - Plugin dengan prioritas yang sama diproses sesuai urutan kemunculannya dalam konfigurasi
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
+ // Sumber JSON utama (prioritas tertinggi)
133
+ syncJSON({
134
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
135
+ location: "main-translations",
136
+ priority: 10,
137
+ }),
138
+
139
+ // Sumber JSON cadangan (prioritas lebih rendah)
140
+ syncJSON({
141
+ source: ({ locale }) => `./fallback-locales/${locale}.json`,
142
+ location: "fallback-translations",
143
+ priority: 5,
144
+ }),
145
+
146
+ // Sumber JSON Legacy (prioritas terendah)
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
+ ### Penyelesaian konflik
157
+
158
+ Ketika kunci terjemahan yang sama ada di beberapa sumber JSON:
159
+
160
+ 1. Plugin dengan prioritas tertinggi menentukan nilai akhir
161
+ 2. Sumber dengan prioritas lebih rendah digunakan sebagai cadangan untuk kunci yang hilang
162
+ 3. Ini memungkinkan Anda mempertahankan terjemahan legacy sambil secara bertahap bermigrasi ke struktur baru
163
+
164
+ ## Integrasi
165
+
166
+ Berikut adalah pemetaan umum. Biarkan runtime Anda tetap tidak berubah; hanya tambahkan plugin.
167
+
168
+ ### i18next
169
+
170
+ Tata letak file tipikal: `./public/locales/{locale}/{namespace}.json` atau `./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
+ Pesan JSON per-locale (sering `./messages/{locale}.json`) atau per-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
+ Lihat juga: `docs/id/intlayer_with_next-intl.md`.
197
+
198
+ ### react-intl
199
+
200
+ JSON tunggal per locale adalah umum:
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
+ Baik satu file per locale atau per-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
+ File JSON yang disinkronkan akan dianggap sebagai file `.content` lainnya. Artinya, semua perintah intlayer akan tersedia untuk file JSON yang disinkronkan. Termasuk:
225
+
226
+ - `intlayer content test` untuk menguji apakah ada terjemahan yang hilang
227
+ - `intlayer content list` untuk mendaftar file JSON yang disinkronkan
228
+ - `intlayer content fill` untuk mengisi terjemahan yang hilang
229
+ - `intlayer content push` untuk mengirim file JSON yang disinkronkan
230
+ - `intlayer content pull` untuk menarik file JSON yang disinkronkan
231
+
232
+ Lihat [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/id/intlayer_cli.md) untuk detail lebih lanjut.
233
+
234
+ ## Keterbatasan (saat ini)
235
+
236
+ - Tidak ada dukungan penyisipan atau bentuk jamak/ICU saat menargetkan pustaka pihak ketiga.
237
+ - Editor visual belum tersedia untuk runtime non-Intlayer.
238
+ - Sinkronisasi hanya untuk JSON; format katalog non-JSON tidak didukung.
239
+
240
+ ## Mengapa ini penting
241
+
242
+ - Kami dapat merekomendasikan solusi i18n yang sudah mapan dan memposisikan Intlayer sebagai tambahan.
243
+ - Kami memanfaatkan SEO/kata kunci mereka dengan tutorial yang berakhir dengan menyarankan Intlayer untuk mengelola JSON.
244
+ - Memperluas audiens yang dapat dijangkau dari “proyek baru” menjadi “tim mana pun yang sudah menggunakan i18n”.
@@ -0,0 +1,244 @@
1
+ ---
2
+ createdAt: 2025-03-13
3
+ updatedAt: 2025-10-05
4
+ title: Plugin Sync JSON
5
+ description: Sincronizza i dizionari Intlayer con file JSON i18n di terze parti (i18next, next-intl, react-intl, vue-i18n e altri). Mantieni il tuo i18n esistente mentre usi Intlayer per gestire, tradurre e testare i tuoi messaggi.
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
+ - traduzioni
21
+ slugs:
22
+ - doc
23
+ - plugin
24
+ - sync-json
25
+ history:
26
+ - version: 6.1.6
27
+ date: 2025-10-05
28
+ changes: Documentazione iniziale del plugin Sync JSON
29
+ ---
30
+
31
+ # Sync JSON (ponti i18n)
32
+
33
+ Usa Intlayer come componente aggiuntivo al tuo stack i18n esistente. Questo plugin mantiene i tuoi messaggi JSON sincronizzati con i dizionari Intlayer così puoi:
34
+
35
+ - Mantenere i18next, next-intl, react-intl, vue-i18n, next-translate, nuxt-i18n, Solid-i18next, svelte-i18n, ecc.
36
+ - Gestire e tradurre i tuoi messaggi con Intlayer (CLI, CI, provider, CMS), senza rifattorizzare la tua app.
37
+ - Pubblicare tutorial e contenuti SEO mirati a ogni ecosistema, suggerendo Intlayer come livello di gestione JSON.
38
+
39
+ Note e ambito attuale:
40
+
41
+ - L’esternalizzazione verso il CMS funziona per traduzioni e testo classico.
42
+ - Non è ancora supportato l’uso di inserimenti, plurali/ICU o funzionalità runtime avanzate di altre librerie.
43
+ - L’editor visuale non è ancora supportato per output i18n di terze parti.
44
+
45
+ ### Quando usare questo plugin
46
+
47
+ - Usi già una libreria i18n e memorizzi i messaggi in file JSON.
48
+ - Vuoi un completamento assistito da AI, test in CI e operazioni sui contenuti senza modificare il runtime di rendering.
49
+
50
+ ## Installazione
51
+
52
+ ```bash
53
+ pnpm add -D @intlayer/sync-json-plugin
54
+ # oppure
55
+ npm i -D @intlayer/sync-json-plugin
56
+ ```
57
+
58
+ ## Avvio rapido
59
+
60
+ Aggiungi il plugin al tuo `intlayer.config.ts` e indirizzalo alla tua struttura JSON esistente.
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
+ // Mantieni i tuoi file JSON attuali sincronizzati con i dizionari Intlayer
73
+ plugins: [
74
+ syncJSON({
75
+ // Layout per locale, per namespace (es. next-intl, i18next con namespaces)
76
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
77
+ }),
78
+ ],
79
+ });
80
+ ```
81
+
82
+ Alternativa: file singolo per locale (comune con configurazioni 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
+ ### Come funziona
93
+
94
+ - Lettura: il plugin individua i file JSON dal tuo builder `source` e li carica come dizionari Intlayer.
95
+ - Scrittura: dopo le build e i riempimenti, scrive i JSON localizzati negli stessi percorsi (con una newline finale per evitare problemi di formattazione).
96
+ - Auto‑fill: il plugin dichiara un percorso `autoFill` per ogni dizionario. Eseguendo `intlayer fill` aggiorna solo le traduzioni mancanti nei tuoi file JSON per impostazione predefinita.
97
+
98
+ API:
99
+
100
+ ```ts
101
+ syncJSON({
102
+ source: ({ key, locale }) => string, // richiesto
103
+ location?: string, // etichetta opzionale, predefinito: "plugin"
104
+ priority?: number, // priorità opzionale per la risoluzione dei conflitti, predefinito: 0
105
+ });
106
+ ```
107
+
108
+ ## Più sorgenti JSON e priorità
109
+
110
+ Puoi aggiungere più plugin `syncJSON` per sincronizzare diverse sorgenti JSON. Questo è utile quando hai più librerie i18n o diverse strutture JSON nel tuo progetto.
111
+
112
+ ### Sistema di priorità
113
+
114
+ Quando più plugin puntano alla stessa chiave del dizionario, il parametro `priority` determina quale plugin ha la precedenza:
115
+
116
+ - I numeri di priorità più alti prevalgono su quelli più bassi
117
+ - La priorità predefinita dei file `.content` è `0`
118
+ - La priorità predefinita dei file di contenuto dei plugin è `-1`
119
+ - I plugin con la stessa priorità vengono elaborati nell'ordine in cui appaiono nella configurazione
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
+ // Sorgente JSON primaria (priorità più alta)
133
+ syncJSON({
134
+ source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
135
+ location: "main-translations",
136
+ priority: 10,
137
+ }),
138
+
139
+ // Sorgente JSON di fallback (priorità più bassa)
140
+ syncJSON({
141
+ source: ({ locale }) => `./fallback-locales/${locale}.json`,
142
+ location: "fallback-translations",
143
+ priority: 5,
144
+ }),
145
+
146
+ // Sorgente JSON legacy (priorità più bassa)
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
+ ### Risoluzione dei conflitti
157
+
158
+ Quando la stessa chiave di traduzione esiste in più sorgenti JSON:
159
+
160
+ 1. Il plugin con la priorità più alta determina il valore finale
161
+ 2. Le sorgenti con priorità inferiore vengono usate come fallback per le chiavi mancanti
162
+ 3. Questo permette di mantenere le traduzioni legacy mentre si migra gradualmente verso nuove strutture
163
+
164
+ ## Integrazioni
165
+
166
+ Di seguito sono riportate le mappature comuni. Mantieni il tuo runtime intatto; aggiungi solo il plugin.
167
+
168
+ ### i18next
169
+
170
+ Layout tipico dei file: `./public/locales/{locale}/{namespace}.json` o `./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
+ Messaggi JSON per locale (spesso `./messages/{locale}.json`) o per 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
+ Vedi anche: `docs/it/intlayer_with_next-intl.md`.
197
+
198
+ ### react-intl
199
+
200
+ È comune un singolo JSON per locale:
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
+ Può essere un singolo file per locale o per 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
+ I file JSON sincronizzati saranno considerati come altri file `.content`. Ciò significa che tutti i comandi di intlayer saranno disponibili per i file JSON sincronizzati. Inclusi:
225
+
226
+ - `intlayer content test` per verificare se ci sono traduzioni mancanti
227
+ - `intlayer content list` per elencare i file JSON sincronizzati
228
+ - `intlayer content fill` per completare le traduzioni mancanti
229
+ - `intlayer content push` per inviare i file JSON sincronizzati
230
+ - `intlayer content pull` per scaricare i file JSON sincronizzati
231
+
232
+ Vedi [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_cli.md) per maggiori dettagli.
233
+
234
+ ## Limitazioni (attuali)
235
+
236
+ - Nessun supporto per inserimenti o plurali/ICU quando si utilizzano librerie di terze parti.
237
+ - L'editor visuale non è ancora disponibile per runtime non Intlayer.
238
+ - Sincronizzazione solo di file JSON; i formati di catalogo non JSON non sono supportati.
239
+
240
+ ## Perché è importante
241
+
242
+ - Possiamo raccomandare soluzioni i18n consolidate e posizionare Intlayer come un componente aggiuntivo.
243
+ - Sfruttiamo la loro SEO/parole chiave con tutorial che terminano suggerendo Intlayer per gestire JSON.
244
+ - Espande il pubblico indirizzabile da “nuovi progetti” a “qualsiasi team che utilizza già i18n”.