@intlayer/docs 9.0.0-canary.7 → 9.0.0-canary.8

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 (98) hide show
  1. package/dist/cjs/generated/docs.entry.cjs +0 -20
  2. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  3. package/dist/esm/generated/docs.entry.mjs +0 -20
  4. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  5. package/dist/types/generated/docs.entry.d.ts +0 -1
  6. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  7. package/docs/ar/dynamic_dictionaries/index.md +24 -18
  8. package/docs/ar/dynamic_dictionaries/variants.md +280 -22
  9. package/docs/ar/plugins/sync-json.md +0 -1
  10. package/docs/ar/releases/v9.md +35 -12
  11. package/docs/de/dynamic_dictionaries/index.md +22 -22
  12. package/docs/de/dynamic_dictionaries/variants.md +272 -14
  13. package/docs/de/plugins/sync-json.md +0 -1
  14. package/docs/de/releases/v9.md +35 -12
  15. package/docs/en/dynamic_dictionaries/index.md +20 -14
  16. package/docs/en/dynamic_dictionaries/variants.md +266 -8
  17. package/docs/en/plugins/sync-json.md +0 -1
  18. package/docs/en/releases/v9.md +35 -12
  19. package/docs/en-GB/dynamic_dictionaries/index.md +21 -15
  20. package/docs/en-GB/dynamic_dictionaries/variants.md +268 -10
  21. package/docs/en-GB/plugins/sync-json.md +0 -1
  22. package/docs/en-GB/releases/v9.md +35 -12
  23. package/docs/es/dynamic_dictionaries/index.md +25 -19
  24. package/docs/es/dynamic_dictionaries/variants.md +275 -17
  25. package/docs/es/plugins/sync-json.md +0 -1
  26. package/docs/es/releases/v9.md +35 -12
  27. package/docs/fr/dynamic_dictionaries/index.md +26 -20
  28. package/docs/fr/dynamic_dictionaries/variants.md +273 -15
  29. package/docs/fr/plugins/sync-json.md +0 -1
  30. package/docs/fr/releases/v9.md +35 -12
  31. package/docs/hi/dynamic_dictionaries/index.md +28 -22
  32. package/docs/hi/dynamic_dictionaries/variants.md +282 -24
  33. package/docs/hi/plugins/sync-json.md +0 -1
  34. package/docs/hi/releases/v9.md +35 -12
  35. package/docs/id/dynamic_dictionaries/index.md +25 -19
  36. package/docs/id/dynamic_dictionaries/variants.md +274 -16
  37. package/docs/id/plugins/sync-json.md +0 -1
  38. package/docs/id/releases/v9.md +35 -12
  39. package/docs/it/dynamic_dictionaries/index.md +26 -20
  40. package/docs/it/dynamic_dictionaries/variants.md +273 -15
  41. package/docs/it/plugins/sync-json.md +0 -1
  42. package/docs/it/releases/v9.md +35 -12
  43. package/docs/ja/dynamic_dictionaries/index.md +27 -21
  44. package/docs/ja/dynamic_dictionaries/variants.md +276 -18
  45. package/docs/ja/plugins/sync-json.md +0 -1
  46. package/docs/ja/releases/v9.md +35 -12
  47. package/docs/ko/dynamic_dictionaries/index.md +23 -17
  48. package/docs/ko/dynamic_dictionaries/variants.md +273 -15
  49. package/docs/ko/plugins/sync-json.md +0 -1
  50. package/docs/ko/releases/v9.md +35 -12
  51. package/docs/pl/dynamic_dictionaries/index.md +26 -20
  52. package/docs/pl/dynamic_dictionaries/variants.md +275 -17
  53. package/docs/pl/plugins/sync-json.md +0 -1
  54. package/docs/pl/releases/v9.md +35 -12
  55. package/docs/pt/dynamic_dictionaries/index.md +25 -19
  56. package/docs/pt/dynamic_dictionaries/variants.md +276 -18
  57. package/docs/pt/plugins/sync-json.md +0 -1
  58. package/docs/pt/releases/v9.md +35 -12
  59. package/docs/ru/dynamic_dictionaries/index.md +25 -19
  60. package/docs/ru/dynamic_dictionaries/variants.md +277 -19
  61. package/docs/ru/plugins/sync-json.md +0 -1
  62. package/docs/ru/releases/v9.md +35 -12
  63. package/docs/tr/dynamic_dictionaries/index.md +27 -21
  64. package/docs/tr/dynamic_dictionaries/variants.md +274 -16
  65. package/docs/tr/plugins/sync-json.md +0 -1
  66. package/docs/tr/releases/v9.md +35 -12
  67. package/docs/uk/dynamic_dictionaries/index.md +25 -19
  68. package/docs/uk/dynamic_dictionaries/variants.md +277 -19
  69. package/docs/uk/plugins/sync-json.md +0 -1
  70. package/docs/uk/releases/v9.md +35 -12
  71. package/docs/vi/dynamic_dictionaries/index.md +28 -22
  72. package/docs/vi/dynamic_dictionaries/variants.md +278 -20
  73. package/docs/vi/plugins/sync-json.md +0 -1
  74. package/docs/vi/releases/v9.md +35 -12
  75. package/docs/zh/dynamic_dictionaries/index.md +24 -18
  76. package/docs/zh/dynamic_dictionaries/variants.md +274 -16
  77. package/docs/zh/plugins/sync-json.md +0 -1
  78. package/docs/zh/releases/v9.md +35 -12
  79. package/package.json +6 -6
  80. package/src/generated/docs.entry.ts +0 -20
  81. package/docs/ar/dynamic_dictionaries/dynamic_content.md +0 -271
  82. package/docs/de/dynamic_dictionaries/dynamic_content.md +0 -271
  83. package/docs/en/dynamic_dictionaries/dynamic_content.md +0 -271
  84. package/docs/en-GB/dynamic_dictionaries/dynamic_content.md +0 -271
  85. package/docs/es/dynamic_dictionaries/dynamic_content.md +0 -271
  86. package/docs/fr/dynamic_dictionaries/dynamic_content.md +0 -271
  87. package/docs/hi/dynamic_dictionaries/dynamic_content.md +0 -271
  88. package/docs/id/dynamic_dictionaries/dynamic_content.md +0 -271
  89. package/docs/it/dynamic_dictionaries/dynamic_content.md +0 -271
  90. package/docs/ja/dynamic_dictionaries/dynamic_content.md +0 -271
  91. package/docs/ko/dynamic_dictionaries/dynamic_content.md +0 -271
  92. package/docs/pl/dynamic_dictionaries/dynamic_content.md +0 -271
  93. package/docs/pt/dynamic_dictionaries/dynamic_content.md +0 -271
  94. package/docs/ru/dynamic_dictionaries/dynamic_content.md +0 -271
  95. package/docs/tr/dynamic_dictionaries/dynamic_content.md +0 -271
  96. package/docs/uk/dynamic_dictionaries/dynamic_content.md +0 -271
  97. package/docs/vi/dynamic_dictionaries/dynamic_content.md +0 -271
  98. package/docs/zh/dynamic_dictionaries/dynamic_content.md +0 -271
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  createdAt: 2026-06-12
3
- updatedAt: 2026-06-12
3
+ updatedAt: 2026-06-26
4
4
  title: Varianti
5
- description: Utilizza il campo dei metadati variant nei file di contenuto di Intlayer per dichiarare alternative di contenuto denominate (test A/B, banner stagionali, testi sotto feature flag) e passare da una all'altra a runtime senza modifiche al codice.
5
+ description: Usa il campo di metadati variant nei file di contenuto Intlayer per dichiarare alternative di contenuto con nome o strutturate — test A/B, banner stagionali, testo con feature flag, record di CMS, contenuti specifici per utente — e passare dall'una all'altra a runtime senza modifiche al codice.
6
6
  keywords:
7
7
  - Varianti
8
8
  - Test A/B
9
9
  - Feature Flag
10
- - Contenuto Dinamico
10
+ - Contenuto dinamico
11
+ - Record dinamici
12
+ - CMS
11
13
  - Intlayer
12
14
  - Internazionalizzazione
13
15
  slugs:
@@ -17,17 +19,27 @@ slugs:
17
19
  history:
18
20
  - version: 9.0.0
19
21
  date: 2026-06-12
20
- changes: "Rilascio della funzionalità delle varianti di dizionari"
22
+ changes: "Rilascio della funzionalità delle varianti"
23
+ - version: 9.1.0
24
+ date: 2026-06-26
25
+ changes: "`variant` ora accetta una stringa o un oggetto — i precedenti `meta` / record dinamici si dichiarano come varianti oggetto"
21
26
  author: aymericzip
22
27
  ---
23
28
 
24
29
  # Varianti
25
30
 
26
- Una **variante** (Variant) è un insieme di file di contenuto che condividono la stessa chiave di dizionario (`key`) ma ognuno porta un nome di variante (`variant`) diverso. Intlayer serve il file appropriato in base al selettore passato a `useIntlayer`.
31
+ Una **variante** è un insieme di file di contenuto che condividono la stessa chiave del dizionario (`key`) ma portano ciascuno un valore `variant` diverso. Intlayer serve il file appropriato in base al selettore passato a `useIntlayer`.
27
32
 
28
- ## Dichiarare le varianti
33
+ Il valore di `variant` può assumere **due forme**:
29
34
 
30
- Ogni file rappresenta un'alternativa denominata. Omettere `variant` (o impostarlo su `"default"`) lo contrassegna come variante di fallback (predefinita).
35
+ - **Una stringa** una singola alternativa con nome (test A/B, banner stagionali, feature flag).
36
+ - **Un oggetto** — un discriminatore strutturato indirizzato da un insieme di campi (record di CMS, contenuti specifici per utente, qualsiasi contenuto con chiave un ID opaco). L'intero oggetto è l'identità: il selettore deve fornire un oggetto **uguale** per risolvere la voce.
37
+
38
+ > La forma a oggetto sostituisce il precedente campo `meta`. Ovunque scrivessi `meta: { id, … }`, scrivi `variant: { id, … }` e selezionala con `{ variant: { id, … } }`.
39
+
40
+ ## Varianti con nome (stringa)
41
+
42
+ Ogni file rappresenta un'alternativa con nome. Omettere `variant` (o impostarlo su `"default"`) la contrassegna come fallback.
31
43
 
32
44
  ```ts fileName="hero-banner.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
33
45
  import { t, type Dictionary } from "intlayer";
@@ -65,9 +77,9 @@ const dictionary = {
65
77
  export default dictionary;
66
78
  ```
67
79
 
68
- ## Consumare le varianti
80
+ ### Consumare varianti con nome
69
81
 
70
- ### Variante predefinita
82
+ #### Variante predefinita
71
83
 
72
84
  <Tabs group="framework">
73
85
  <Tab label="React" value="react">
@@ -209,7 +221,7 @@ export default dictionary;
209
221
  </Tab>
210
222
  </Tabs>
211
223
 
212
- ### Variante denominata
224
+ #### Variante con nome
213
225
 
214
226
  ```tsx
215
227
  const { headline, cta } = useIntlayer("hero-banner", {
@@ -217,18 +229,264 @@ const { headline, cta } = useIntlayer("hero-banner", {
217
229
  });
218
230
  ```
219
231
 
220
- ### Variante denominata con locale esplicita
232
+ #### Variante con nome con locale esplicito
221
233
 
222
234
  ```tsx
223
235
  const content = useIntlayer("hero-banner", {
224
236
  variant: "black_friday",
225
- locale: "it",
237
+ locale: "fr",
226
238
  });
227
239
  ```
228
240
 
241
+ ## Varianti oggetto (strutturate)
242
+
243
+ Una variante oggetto indirizza il contenuto tramite un insieme arbitrario di coppie chiave-valore dichiarate nel campo `variant` — rendendo possibile modellare record di CMS, contenuti specifici per utente o qualsiasi contenuto la cui chiave è un ID opaco. L'**intero oggetto** è l'identità: il selettore deve fornire un oggetto uguale affinché la voce venga risolta.
244
+
245
+ ```ts fileName="product.abc.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
246
+ import { t, type Dictionary } from "intlayer";
247
+
248
+ const dictionary = {
249
+ key: "product",
250
+ variant: { id: "prod_abc", userId: "user_123" },
251
+ content: {
252
+ name: t({ en: "Widget Pro", fr: "Widget Pro" }),
253
+ description: t({ en: "The best widget.", fr: "Le meilleur widget." }),
254
+ },
255
+ } satisfies Dictionary;
256
+
257
+ export default dictionary;
258
+ ```
259
+
260
+ ```ts fileName="product.abcd.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
261
+ import { t, type Dictionary } from "intlayer";
262
+
263
+ const dictionary = {
264
+ key: "product",
265
+ variant: { id: "prod_abcd", userId: "user_123" },
266
+ content: {
267
+ name: t({ en: "Widget Lite", fr: "Widget Lite" }),
268
+ description: t({ en: "A lighter option.", fr: "Une option plus légère." }),
269
+ },
270
+ } satisfies Dictionary;
271
+
272
+ export default dictionary;
273
+ ```
274
+
275
+ ### Consumare varianti oggetto
276
+
277
+ Passa l'oggetto corrispondente a `variant`. Ogni campo dichiarato nel dizionario deve essere fornito e uguale; altrimenti il risultato è `null`. L'ordine dei campi non ha importanza.
278
+
279
+ <Tabs group="framework">
280
+ <Tab label="React" value="react">
281
+ ```tsx fileName="Product.tsx" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
282
+ import { useIntlayer } from "react-intlayer";
283
+
284
+ export const Product = ({
285
+ productId,
286
+ userId,
287
+ }: {
288
+ productId: string;
289
+ userId: string;
290
+ }) => {
291
+ const content = useIntlayer("product", {
292
+ variant: { id: productId, userId },
293
+ });
294
+
295
+ if (!content) return null;
296
+
297
+ return <p>{content.description}</p>;
298
+ };
299
+ ```
300
+
301
+ </Tab>
302
+ <Tab label="Next.js" value="nextjs">
303
+ ```tsx fileName="Product.tsx" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
304
+ import { useIntlayer } from "next-intlayer";
305
+
306
+ export const Product = ({
307
+ productId,
308
+ userId,
309
+ }: {
310
+ productId: string;
311
+ userId: string;
312
+ }) => {
313
+ const content = useIntlayer("product", {
314
+ variant: { id: productId, userId },
315
+ });
316
+
317
+ if (!content) return null;
318
+
319
+ return <p>{content.description}</p>;
320
+ };
321
+ ```
322
+
323
+ </Tab>
324
+ <Tab label="Vue" value="vue">
325
+ ```vue fileName="Product.vue" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
326
+ <script setup>
327
+ import { useIntlayer } from "vue-intlayer";
328
+
329
+ const props = defineProps({
330
+ productId: String,
331
+ userId: String,
332
+ });
333
+
334
+ const content = useIntlayer("product", {
335
+ variant: { id: props.productId, userId: props.userId },
336
+ });
337
+ </script>
338
+
339
+ <template>
340
+ <p v-if="content">{{ content.description }}</p>
341
+ </template>
342
+ ```
343
+
344
+ </Tab>
345
+ <Tab label="Svelte" value="svelte">
346
+ ```svelte fileName="Product.svelte" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
347
+ <script lang="ts">
348
+ import { useIntlayer } from "svelte-intlayer";
349
+
350
+ export let productId: string;
351
+ export let userId: string;
352
+
353
+ const content = useIntlayer("product", {
354
+ variant: { id: productId, userId },
355
+ });
356
+ </script>
357
+
358
+ {#if $content}
359
+ <p>{$content.description}</p>
360
+ {/if}
361
+ ```
362
+
363
+ </Tab>
364
+ <Tab label="Preact" value="preact">
365
+ ```tsx fileName="Product.tsx" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
366
+ import { useIntlayer } from "preact-intlayer";
367
+
368
+ export const Product = ({
369
+ productId,
370
+ userId,
371
+ }: {
372
+ productId: string;
373
+ userId: string;
374
+ }) => {
375
+ const content = useIntlayer("product", {
376
+ variant: { id: productId, userId },
377
+ });
378
+
379
+ if (!content) return null;
380
+
381
+ return <p>{content.description}</p>;
382
+ };
383
+ ```
384
+
385
+ </Tab>
386
+ <Tab label="Solid" value="solid">
387
+ ```tsx fileName="Product.tsx" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
388
+ import { useIntlayer } from "solid-intlayer";
389
+
390
+ export const Product = (props: {
391
+ productId: string;
392
+ userId: string;
393
+ }) => {
394
+ const content = useIntlayer("product", {
395
+ variant: { id: props.productId, userId: props.userId },
396
+ });
397
+
398
+ return (
399
+ <>
400
+ {content() && <p>{content().description}</p>}
401
+ </>
402
+ );
403
+ };
404
+ ```
405
+
406
+ </Tab>
407
+ <Tab label="Angular" value="angular">
408
+ ```typescript fileName="product.component.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
409
+ import { Component, Input, OnInit } from "@angular/core";
410
+ import { useIntlayer } from "angular-intlayer";
411
+
412
+ @Component({
413
+ selector: "app-product",
414
+ template: `
415
+ @if (content()) {
416
+ <p>{{ content().description }}</p>
417
+ }
418
+ `,
419
+ })
420
+ export class ProductComponent implements OnInit {
421
+ @Input() productId!: string;
422
+ @Input() userId!: string;
423
+
424
+ content: any;
425
+
426
+ ngOnInit() {
427
+ this.content = useIntlayer("product", {
428
+ variant: { id: this.productId, userId: this.userId },
429
+ });
430
+ }
431
+ }
432
+ ```
433
+
434
+ </Tab>
435
+ <Tab label="Vanilla JS" value="vanilla">
436
+ ```javascript fileName="product.js"
437
+ import { useIntlayer } from "vanilla-intlayer";
438
+
439
+ const content = useIntlayer("product", {
440
+ variant: { id: "prod_abcd", userId: "user_123" },
441
+ });
442
+
443
+ if (content) {
444
+ document.body.innerHTML = `<p>${content.description}</p>`;
445
+ }
446
+ ```
447
+
448
+ </Tab>
449
+ </Tabs>
450
+
451
+ #### Con locale esplicito
452
+
453
+ ```tsx
454
+ const content = useIntlayer("product", {
455
+ variant: { id: "prod_abc", userId: "user_123" },
456
+ locale: "fr",
457
+ });
458
+ ```
459
+
460
+ #### Campo mancante — nessuna corrispondenza
461
+
462
+ ```ts
463
+ // Restituisce null: manca `userId`, quindi l'oggetto non corrisponde alla variante dichiarata
464
+ const content = useIntlayer("product", { variant: { id: "prod_abc" } });
465
+ ```
466
+
467
+ ## Modalità di caricamento
468
+
469
+ Le varianti oggetto sono spesso caricate in modo differito. Imposta `importMode` sul dizionario per controllarlo:
470
+
471
+ ```ts contentDeclarationFormat={["typescript", "esm", "commonjs"]}
472
+ const dictionary = {
473
+ key: "product",
474
+ importMode: "fetch", // or "dynamic"
475
+ variant: { id: "prod_abc", userId: "user_123" },
476
+ content: { … },
477
+ } satisfies Dictionary;
478
+
479
+ export default dictionary;
480
+ ```
481
+
482
+ Vedi [ottimizzazione del bundle](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/bundle_optimization.md) per i dettagli sulle modalità `static`, `dynamic` e `fetch`.
483
+
229
484
  ## Casi d'uso tipici
230
485
 
231
- - Test A/B guidati da una chiave di esperimento
486
+ - Test A/B di testo guidati da una chiave di esperimento
232
487
  - Banner stagionali o promozionali
233
- - Messaggi condizionati da feature flag
234
- - Campagne di marketing specifiche per area geografica
488
+ - Messaggistica con feature flag
489
+ - Campagne di marketing specifiche per locale
490
+ - Testo di marketing per prodotto gestito in un CMS
491
+ - Contenuti specifici per utente o account
492
+ - Qualsiasi contenuto indicizzato da un ID opaco a runtime
@@ -108,7 +108,6 @@ const config: IntlayerConfig = {
108
108
  * Caricherà e scriverà l'output e le traduzioni nei file JSON nella directory locales
109
109
  */
110
110
  syncJSON({
111
- format: "i18next",
112
111
  source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
113
112
  priority: 0,
114
113
  format: "i18next",
@@ -1,15 +1,14 @@
1
1
  ---
2
2
  createdAt: 2026-06-14
3
- updatedAt: 2026-06-25
3
+ updatedAt: 2026-06-26
4
4
  title: Nuovo Intlayer v9 - Cosa c'è di nuovo?
5
- description: Scopri le novità di Intlayer v9. Introduzione di package di compatibilità drop-in per le più diffuse librerie i18n e supporto per Collections, Variants e Dynamic Records.
5
+ description: Scopri le novità di Intlayer v9. Introduzione di package di compatibilità drop-in per le più diffuse librerie i18n e supporto per Collections e Variants.
6
6
  keywords:
7
7
  - Intlayer
8
8
  - Compatibilità
9
9
  - Migrazione
10
10
  - Collections
11
11
  - Variants
12
- - Dynamic Records
13
12
  - i18next
14
13
  - next-intl
15
14
  - vue-i18n
@@ -22,7 +21,7 @@ author: aymericzip
22
21
 
23
22
  # Nuovo Intlayer v9 - Cosa c'è di nuovo?
24
23
 
25
- Benvenuti a Intlayer v9! Questa major release segna un'enorme pietra miliare nella semplificazione del percorso di migrazione a Intlayer con i **Compat Adapter Packages** per le principali librerie i18n (`react-i18next`, `next-intl`, `vue-i18n`, ecc.) e aggiunge il supporto per strutture di contenuto ricche: **Collections**, **Variants** e **Dynamic Records**.
24
+ Benvenuti a Intlayer v9! Questa major release segna un'enorme pietra miliare nella semplificazione del percorso di migrazione a Intlayer con i **Compat Adapter Packages** per le principali librerie i18n (`react-i18next`, `next-intl`, `vue-i18n`, ecc.) e aggiunge il supporto per strutture di contenuto ricche: **Collections** e **Variants**.
26
25
 
27
26
  ## Indice
28
27
 
@@ -41,8 +40,10 @@ Sostituendo gli import, ottieni tutti i vantaggi di Intlayer (inclusa la type sa
41
40
  - `@intlayer/i18next`
42
41
  - `@intlayer/react-i18next`
43
42
  - `@intlayer/next-intl`
43
+ - `@intlayer/react-intl`
44
44
  - `@intlayer/next-i18next`
45
45
  - `@intlayer/vue-i18n`
46
+ - `@intlayer/lingui`
46
47
 
47
48
  Ad esempio, è sufficiente cambiare:
48
49
 
@@ -100,7 +101,7 @@ Tutti i compat adapter ora instradano la risoluzione delle traduzioni attraverso
100
101
 
101
102
  ---
102
103
 
103
- ## Specifica delle Funzionalità: Collections, Variants & Dynamic Records
104
+ ## Specifica delle Funzionalità: Collections & Variants
104
105
 
105
106
  Intlayer v9 si espande oltre gli oggetti chiave-valore statici, consentendo ai dizionari di dichiarare strutture di layout dinamiche che sono completamente tipizzate end-to-end.
106
107
 
@@ -144,6 +145,8 @@ const faq = useIntlayer("faq", { item: 1 }); // -> { question: string, answer: s
144
145
 
145
146
  Fornisci A/B test, header stagionali, feature flag o landing page personalizzate:
146
147
 
148
+ #### Varianti stringa (es. test A/B)
149
+
147
150
  ```ts fileName="hero.content.ts"
148
151
  import { t, type Dictionary } from "intlayer";
149
152
 
@@ -167,16 +170,14 @@ export default {
167
170
  const banner = useIntlayer("hero-banner", { variant: "black_friday" });
168
171
  ```
169
172
 
170
- ### 3. Dynamic Records
171
-
172
- Definisci dizionari le cui voci vengono caricate dinamicamente a runtime tramite ID di query:
173
+ #### Varianti oggetto (es. Dynamic Records)
173
174
 
174
175
  ```ts fileName="product.content.ts"
175
176
  import { t, type Dictionary } from "intlayer";
176
177
 
177
178
  export default {
178
179
  key: "product-copy",
179
- meta: {
180
+ variant: {
180
181
  id: "prod_123",
181
182
  category: "books",
182
183
  },
@@ -229,7 +230,7 @@ export default defineConfig({
229
230
  });
230
231
  ```
231
232
 
232
- - **Compiler**: Si attiva automaticamente quando `compiler.enabled` è impostato e un percorso `compiler.output` è configurato. Non è più necessario registrare `intlayerCompiler()` separatamente.
233
+ - **Compiler**: Si attiva automaticamente quando `compiler.enabled` è impostato su `true` e un percorso `compiler.output` è configurato. Non è più necessario registrare `intlayerCompiler()` separatamente.
233
234
  - **Proxy**: Si attiva automaticamente in base alla nuova opzione `routing.enableProxy` (`true` per impostazione predefinita). Collega il middleware di rilevamento locale / reindirizzamento / riscrittura in sviluppo, anteprima e SSR in produzione. Non è più necessario registrare `intlayerProxy()` separatamente.
234
235
 
235
236
  ### Opzione `routing.enableProxy`
@@ -252,6 +253,27 @@ I plugin standalone `intlayerCompiler()` e `intlayerProxy()` rimangono esportati
252
253
 
253
254
  ---
254
255
 
256
+ ## Compilatore disabilitato per impostazione predefinita
257
+
258
+ A partire da Intlayer v9, il **compilatore è disabilitato per impostazione predefinita** (`compiler.enabled` ora ha come valore predefinito `false`). Per abilitare l'estrazione dei tuoi file `.content.ts` in fase di build, imposta `compiler.enabled: true` nella tua configurazione:
259
+
260
+ ```ts fileName="intlayer.config.ts"
261
+ import type { IntlayerConfig } from "intlayer";
262
+
263
+ const config: IntlayerConfig = {
264
+ compiler: {
265
+ enabled: true, // Predefinito: false — richiesto per abilitare il compilatore dalla v9
266
+ output: ({ fileName }) => `./${fileName}.content.ts`,
267
+ },
268
+ };
269
+
270
+ export default config;
271
+ ```
272
+
273
+ Quando il compilatore è disabilitato, Intlayer salta il passaggio di estrazione in fase di build e si basa sui dizionari che hai già dichiarato. Abilitalo solo quando vuoi che il plugin del bundler (`@intlayer/swc`, `@intlayer/babel` o il plugin Vite `intlayer()`) estragga il contenuto automaticamente.
274
+
275
+ ---
276
+
255
277
  ## React Native: importazioni da un unico pacchetto
256
278
 
257
279
  In un'app React Native o Expo, non è più necessario destreggiarsi tra `react-intlayer` e `react-native-intlayer`. Il pacchetto `react-native-intlayer` ora **riesporta l'intera API `react-intlayer`** (hook, utility e i sottopercorsi `/format`, `/html` e `/markdown`), e il suo `IntlayerProvider` applica automaticamente i polyfill di React Native.
@@ -278,13 +300,14 @@ npm install intlayer react-native-intlayer
278
300
 
279
301
  Se stai eseguendo l'aggiornamento da v8, nota che la v9 non include breaking changes. Ma ecco le modifiche chiave:
280
302
 
303
+ - **Compilatore disabilitato per impostazione predefinita**: `compiler.enabled` ora ha come valore predefinito `false`. Se dipendi dall'estrazione dei tuoi file `.content.ts` in fase di build, imposta `compiler.enabled: true` nel tuo `intlayer.config.ts`.
281
304
  - **Locales & Dialects**: Se utilizzi dipendenze i18n esterne, aggiungi i rispettivi compat adapter plugin nella tua configurazione o setup del bundler per riscrivere automaticamente gli import.
282
- - **Custom Selectors**: Quando chiami `useIntlayer`, il secondo parametro è ora riservato a un oggetto di opzioni contenente `{ locale, item, variant, id }`. Se in precedenza passavi direttamente una stringa locale, puoi ancora farlo, ma l'utilizzo dell'oggetto di opzioni è consigliato per selezioni avanzate.
305
+ - **Custom Selectors**: Quando chiami `useIntlayer`, il secondo parametro è ora riservato a un oggetto di opzioni contenente `{ locale, item, variant }`. Se in precedenza passavi direttamente una stringa locale, puoi ancora farlo, ma l'utilizzo dell'oggetto di opzioni è consigliato per selezioni avanzate.
283
306
 
284
307
  ---
285
308
 
286
309
  ## Link utili
287
310
 
288
311
  - [Guida ai Compat Adapter Packages](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/compat/index.md)
289
- - [Dizionari Dinamici - Collections, Variants & Dynamic Records](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dynamic_dictionaries/index.md)
312
+ - [Dizionari Dinamici - Collections & Variants](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dynamic_dictionaries/index.md)
290
313
  - [Riferimento alla Configurazione](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/configuration.md)
@@ -1,13 +1,12 @@
1
1
  ---
2
2
  createdAt: 2026-06-12
3
- updatedAt: 2026-06-12
4
- title: 動的ディクショナリ
5
- description: 柔軟でランタイム駆動のi18nコンテンツを構築するための、Intlayerの3つの動的ディクショナリ機能 コレクション、バリアント、動的レコード — の概要。
3
+ updatedAt: 2026-06-26
4
+ title: 動的辞書
5
+ description: Intlayer の動的辞書機能(コレクションとバリアント)の概要。柔軟でランタイム駆動の i18n コンテンツを構築するために。
6
6
  keywords:
7
- - 動的ディクショナリ
7
+ - 動的辞書
8
8
  - コレクション
9
9
  - バリアント
10
- - 動的レコード
11
10
  - Intlayer
12
11
  - 国際化
13
12
  slugs:
@@ -17,32 +16,39 @@ slugs:
17
16
  history:
18
17
  - version: 9.0.0
19
18
  date: 2026-06-12
20
- changes: "動的ディクショナリ機能のリリース"
19
+ changes: "動的辞書機能のリリース"
20
+ - version: 9.1.0
21
+ date: 2026-06-26
22
+ changes: "動的レコードをバリアントに統合 — `variant` が文字列またはオブジェクトを受け取るようになりました"
21
23
  author: aymericzip
22
24
  ---
23
25
 
24
- # 動的ディクショナリ
26
+ # 動的辞書
25
27
 
26
- Intlayerは、キーごとに単一の静的ディクショナリを定義するだけでなく、それを超えたコンテンツを表現するための3つのメカニズムをサポートしています。それぞれ、コンテンツファイル内の**最上位メタデータフィールド**を介して宣言され、ラッパー関数は不要です。
28
+ Intlayer は、キーごとの単一の静的辞書を超えるコンテンツを表現するための 2 つのメカニズムをサポートします。それぞれはコンテンツファイル内の**トップレベルのメタデータフィールド**で宣言され、ラッパー関数は不要です。
27
29
 
28
- | 機能 | メタデータフィールド | `useIntlayer` でのセレクター |
29
- | --------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------- |
30
- | [コレクション](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/collections.md) | `item: N` | `{ item: N }` |
31
- | [バリアント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/variants.md) | `variant: "name"` | `{ variant: "name" }` |
32
- | [動的レコード](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/dynamic_content.md) | `meta: { id, … }` | `{ id, … }` |
30
+ | 機能 | メタデータフィールド | `useIntlayer` のセレクター |
31
+ | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------- |
32
+ | [コレクション](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/collections.md) | `item: N` | `{ item: N }` |
33
+ | [バリアント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/variants.md) | `variant: "name"` _または_ `variant: { … }` | `{ variant: "name" }` _または_ `{ variant: { … } }` |
33
34
 
34
- 3つのメカニズムすべてがロケール引数と連携し、`importMode` を介した選択的 / 遅延読み込みをサポートしています。
35
+ いずれも locale 引数と組み合わせられ、`importMode` による選択的 / 遅延読み込みをサポートします。
35
36
 
36
- ## 使い分け
37
+ ## どちらをいつ使うか
37
38
 
38
- - **コレクション** — 別ファイルで管理されるアイテムの順序付きリスト(FAQ項目、ブログ記事、商品など)。
39
- - **バリアント** — A/Bテスト、季節限定のバナー、または機能フラグ(feature flags)用の、名前付きコンテンツ代替案。
40
- - **動的レコード** — 不透明なIDを使用してランタイムに取得されるコンテンツ(CMSレコード、ユーザー固有のコピーなど)。
39
+ - **コレクション** — 別々のファイルで管理される順序付きの項目リスト(FAQ 項目、ブログ記事、商品)。
40
+ - **バリアント** — 名前付きまたは構造化されたコンテンツの代替:
41
+ - A/B テスト、季節バナー、フィーチャーフラグ向けの**文字列**バリアント。
42
+ - CMS レコード、ユーザー固有のコピー、またはフィールドの集合でアドレス指定される任意のコンテンツ向けの**オブジェクト**バリアント(旧「動的レコード」)。
41
43
 
42
- ## セレクターの競合解決
44
+ > 以前のバージョンでは、レコードキー付きコンテンツ用に別個の `meta` フィールドを公開していました。これは `variant` に統合されました。`meta` を使う代わりに `variant` に**オブジェクト**を渡してください。
43
45
 
44
- 1つのディクショナリに複数のセレクターが存在する場合、解決の優先順位は次のようになります:
46
+ ## セレクターの曖昧性解消
47
+
48
+ キーは両方の次元を同時に宣言できます(例: 各項目にバリアントを持つコレクション)。これらは次の順序で解決されます:
45
49
 
46
50
  ```
47
- variant → meta → item
51
+ variant → item
48
52
  ```
53
+
54
+ したがって、variant × item キーでの `{ variant: "promo" }` はすべての promo 項目を配列として返し、`{ item: 2 }` を追加すると単一のエントリに絞り込まれます。