מחבר:
הפנו את עוזר ה-AI המועדף עליכם למסמך הזהChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Release of the collection dictionaries feature"v9.0.012.6.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתעריכת המסמך הזה
אם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודנוצר:2026-06-12עדכון אחרון:2026-09-27
העתקה
העתקת ה-Markdown של המסמך ללוח
Collections
A collection is a set of content files that share the same dictionary key but each declare a different item index. Intlayer merges them into a single ordered list at build time.
Declaring collection items
Each file represents one item. The item field is its position in the list (1-based).
faq.1.content.ts
העתקת קוד
העתקת הקוד ללוח
import { t, type Dictionary } from "intlayer";
const dictionary = {
key: "faq",
item: 1,
content: {
question: t({ en: "What is Intlayer?", fr: "Qu'est-ce qu'Intlayer ?" }),
answer: t({ en: "An i18n toolkit.", fr: "Une boîte à outils i18n." }),
},
} satisfies Dictionary;
export default dictionary;
faq.2.content.ts
העתקת קוד
העתקת הקוד ללוח
import { t, type Dictionary } from "intlayer";
const dictionary = {
key: "faq",
item: 2,
content: {
question: t({ en: "Is it free?", fr: "Est-ce gratuit ?" }),
answer: t({ en: "Yes, open-source.", fr: "Oui, open-source." }),
},
} satisfies Dictionary;
export default dictionary;
Consuming a collection
All items
FAQ.tsx
העתקת קוד
העתקת הקוד ללוח
FAQ.tsx
העתקת קוד
העתקת הקוד ללוח
FAQ.vue
העתקת קוד
העתקת הקוד ללוח
FAQ.svelte
העתקת קוד
העתקת הקוד ללוח
FAQ.tsx
העתקת קוד
העתקת הקוד ללוח
FAQ.tsx
העתקת קוד
העתקת הקוד ללוח
faq.component.ts
העתקת קוד
העתקת הקוד ללוח
faq.js
העתקת קוד
העתקת הקוד ללוח
Single item by index
tsx
העתקת קוד
העתקת הקוד ללוח
Single item with explicit locale
tsx
העתקת קוד
העתקת הקוד ללוח
Typical use-cases
- FAQ lists
- Pricing tiers
- Carousel / slider slides
- Step-by-step instructions
