aymericzip/intlayer-skills / skills/intlayer-preact
intlayer-preact
VerifiedIntegrates Intlayer internationalization with Preact applications. Use when the user asks to "setup Preact i18n", create a new translated component, use the "useIntlayer" hook in Preact, or configure providers.
| File | Kind | Size |
|---|---|---|
| LICENCE.md | markdown | 10.7 KB |
| SKILL.md | skill md | 2.7 KB |
| references/compiler.md | markdown | 14.6 KB |
| references/concept_collections.md | markdown | 5.6 KB |
| references/concept_variants.md | markdown | 20.9 KB |
| references/environment_astro_preact.md | markdown | 37.9 KB |
| references/environment_vite-and-preact.md | markdown | 53.3 KB |
| references/formatters.md | markdown | 17.3 KB |
| references/packages_intlayer_exports.md | markdown | 12.4 KB |
| references/packages_preact-intlayer_exports.md | markdown | 3.2 KB |
| references/packages_preact-intlayer_usePathname.md | markdown | 3.3 KB |
references/concept_collections.md
View on GitHub---
createdAt: 2026-06-12
updatedAt: 2026-09-27
priority: 8
title: "Collections: Ordered Lists of Localized Items"
description: Use the item metadata field in Intlayer content files to build ordered collections of localized items selectable by index at runtime.
keywords:
- Collections
- Content List
- Dynamic Content
- Intlayer
- Internationalization
slugs:
- doc
- concept
- collections
history:
- version: 9.0.0
date: 2026-06-12
changes: "Release of the collection dictionaries feature"
author: aymericzip
---
# 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).
```ts fileName="faq.1.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
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;
```
```ts fileName="faq.2.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
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
<Tabs group="framework">
<Tab label="React" value="react">
```tsx fileName="FAQ.tsx"
import { useIntlayer } from "react-intlayer";
export const FAQ = () => {
const items = useIntlayer("faq"); // { question: string; answer: string }[]
return (
<ul>
{items.map((item, index) => (
<li key={index}>
<strong>{item.question}</strong>
<p>{item.answer}</p>
</li>
))}
</ul>
);
};
```
</Tab>
<Tab label="Next.js" value="nextjs">
```tsx fileName="FAQ.tsx"
import { useIntlayer } from "next-intlayer";
export const FAQ = () => {
const items = useIntlayer("faq"); // { question: string; answer: string }[]
return (
<ul>
{items.map((item, index) => (
<li key={index}>
<strong>{item.question}</strong>
<p>{item.answer}</p>
</li>
))}
</ul>
);
};
```
</Tab>
<Tab label="Vue" value="vue">
```vue fileName="FAQ.vue"
<script setup>
import { useIntlayer } from "vue-intlayer";
const items = useIntlayer("faq");
</script>
<template>
<ul>
<li v-for="(item, index) in items" :key="index">
<strong>{{ item.question }}</strong>
<p>{{ item.answer }}</p>
</li>
</ul>
</template>
```
</Tab>
<Tab label="Svelte" value="svelte">
```svelte fileName="FAQ.svelte"
<script lang="ts">
import { useIntlayer } from "svelte-intlayer";
const items = useIntlayer("faq");
</script>
<ul>
{#each $items as item}
<li>
<strong>{item.question}</strong>
<p>{item.answer}</p>
</li>
{/each}
</ul>
```
</Tab>
<Tab label="Preact" value="preact">
```tsx fileName="FAQ.tsx"
import { useIntlayer } from "preact-intlayer";
export const FAQ = () => {
const items = useIntlayer("faq"); // { question: string; answer: string }[]
return (
<ul>
{items.map((item, index) => (
<li key={index}>
<strong>{item.question}</strong>
<p>{item.answer}</p>
</li>
))}
</ul>
);
};
```
</Tab>
<Tab label="Solid" value="solid">
```tsx fileName="FAQ.tsx"
import { useIntlayer } from "solid-intlayer";
import { For } from "solid-js";
export const FAQ = () => {
const items = useIntlayer("faq"); // { question: string; answer: string }[]
return (
<ul>
<For each={items()}>
{(item) => (
<li>
<strong>{item.question}</strong>
<p>{item.answer}</p>
</li>
)}
</For>
</ul>
);
};
```
</Tab>
<Tab label="Angular" value="angular">
```typescript fileName="faq.component.ts"
import { Component } from "@angular/core";
import { useIntlayer } from "angular-intlayer";
@Component({
selector: "app-faq",
template: `
<ul>
@for (item of items(); track $index) {
<li>
<strong>{{ item.question }}</strong>
<p>{{ item.answer }}</p>
</li>
}
</ul>
`,
})
export class FAQComponent {
items = useIntlayer("faq");
}
```
</Tab>
<Tab label="Vanilla JS" value="vanilla">
```javascript fileName="faq.js"
import { useIntlayer } from "vanilla-intlayer";
const faq = useIntlayer("faq");
faq.forEach((item) => {
console.log(item.question);
console.log(item.answer);
});
```
</Tab>
</Tabs>
### Single item by index
```tsx
const faq2 = useIntlayer("faq", { item: 2 });
// → { question: string; answer: string }
```
### Single item with explicit locale
```tsx
const faq2Fr = useIntlayer("faq", { item: 2, locale: "fr" });
```
## Typical use-cases
- FAQ lists
- Pricing tiers
- Carousel / slider slides
- Step-by-step instructions
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |