Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Release of the collection dictionaries feature"v9.0.06/12/2026
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
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).
Copy the code to the clipboard
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;Copy the code to the clipboard
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
Copy the code to the clipboard
Single item by index
Copy the code to the clipboard
Single item with explicit locale
Copy the code to the clipboard
Typical use-cases
- FAQ lists
- Pricing tiers
- Carousel / slider slides
- Step-by-step instructions