\n\n \n ```\n\n \n \n ```svelte fileName=\"FAQ.svelte\"\n \n\n \n ```\n\n \n \n ```tsx fileName=\"FAQ.tsx\"\n import { useIntlayer } from \"preact-intlayer\";\n\n export const FAQ = () => {\n const items = useIntlayer(\"faq\"); // { question: string; answer: string }[]\n\n return (\n \n );\n };\n ```\n\n \n \n ```tsx fileName=\"FAQ.tsx\"\n import { useIntlayer } from \"solid-intlayer\";\n import { For } from \"solid-js\";\n\n export const FAQ = () => {\n const items = useIntlayer(\"faq\"); // { question: string; answer: string }[]\n\n return (\n \n );\n };\n ```\n\n \n \n ```typescript fileName=\"faq.component.ts\"\n import { Component } from \"@angular/core\";\n import { useIntlayer } from \"angular-intlayer\";\n\n @Component({\n selector: \"app-faq\",\n template: `\n \n `,\n })\n export class FAQComponent {\n items = useIntlayer(\"faq\");\n }\n ```\n\n \n \n ```javascript fileName=\"faq.js\"\n import { useIntlayer } from \"vanilla-intlayer\";\n\n const faq = useIntlayer(\"faq\");\n\n faq.forEach((item) => {\n console.log(item.question);\n console.log(item.answer);\n });\n ```\n\n \n\n\n### Pojedynczy element według indeksu\n\n```tsx\nconst faq2 = useIntlayer(\"faq\", { item: 2 });\n// → { question: string; answer: string }\n```\n\n### Pojedynczy element z wyraźnym wskazaniem lokalizacji\n\n```tsx\nconst faq2Pl = useIntlayer(\"faq\", { item: 2, locale: \"pl\" });\n```\n\n## Typowe przypadki użycia\n\n- Listy FAQ (najczęściej zadawane pytania)\n- Plany cenowe / cenniki\n- Slajdy w karuzelach i sliderach\n- Instrukcje krok po kroku\n","description":"Użyj pola metadanych item w plikach zawartości Intlayer, aby budować uporządkowane kolekcje zlokalizowanych elementów wybieranych według indeksu w czasie wykonywania.","url":"https://intlayer.org/pl/doc/concept/collections","datePublished":"2026-06-12","dateModified":"2026-06-12","version":"9.0.0","keywords":"Kolekcje, Lista Zawartości, Zawartość Dynamiczna, Intlayer, Umiędzynarodowienie","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Programiści, Menedżerowie treści"}}
    Autor:
    Data utworzenia:2026-06-12Ostatnia aktualizacja:2026-06-12

    Kolekcje

    Kolekcja (Collection) to zestaw plików zawartości, które współdzielą ten sam klucz słownika (key), ale każdy deklaruje inny indeks elementu (item). Intlayer scala je w jedną uporządkowaną listę podczas budowania projektu.

    Deklarowanie elementów kolekcji

    Każdy plik reprezentuje jeden element. Pole item to jego pozycja na liście (indeksowanie od 1).

    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;

    Używanie kolekcji

    Wszystkie elementy

    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>  );};

    Pojedynczy element według indeksu

    tsx
    const faq2 = useIntlayer("faq", { item: 2 });// → { question: string; answer: string }

    Pojedynczy element z wyraźnym wskazaniem lokalizacji

    tsx
    const faq2Pl = useIntlayer("faq", { item: 2, locale: "pl" });

    Typowe przypadki użycia

    • Listy FAQ (najczęściej zadawane pytania)
    • Plany cenowe / cenniki
    • Slajdy w karuzelach i sliderach
    • Instrukcje krok po kroku