שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Release of the dynamic dictionaries feature"v9.0.012.6.2026
- "Merged dynamic records into variants, `variant` now accepts a string or an object"v9.1.026.6.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
Dynamic Dictionaries
Intlayer supports two mechanisms for expressing content that goes beyond a single static dictionary per key. Each is declared through a top-level metadata field in the content file; no wrapper function is needed.
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Feature | Metadata field | Selector in useIntlayer |
|---|---|---|
| Collections | item: N | { item: N } |
| Variants | variant: "name" or variant: { … } | { variant: "name" } or { variant: { … } } |
Both compose with the locale argument and support selective / lazy loading via importMode.
When to use which
- Collections: ordered list of items managed in separate files (FAQ entries, blog posts, products).
- Variants: named or structured content alternatives:
- a string variant for A/B tests, seasonal banners, or feature flags;
- an object variant for CMS records, user-specific copy, or any content addressed by a set of fields (the former "dynamic records").
Earlier versions exposed a separatemetafield for record-keyed content. It has been merged intovariant: pass an object tovariantinstead of usingmeta.
Selector disambiguation
A key may declare both dimensions at once (e.g. a collection whose items each have a variant). They are resolved in the order:
העתקת הקוד ללוח
So { variant: "promo" } on a variant × item key returns every promo item as an array, and adding { item: 2 } narrows it to a single entry.
