--- createdAt: 2026-06-12 updatedAt: 2026-06-12 title: 컬렉션 description: 런타임 시 인덱스로 선택 가능한 정렬된 번역 항목 컬렉션을 구축하기 위해 Intlayer 콘텐츠 파일에서 item 메타데이터 필드를 사용합니다. keywords: - 컬렉션 - 콘텐츠 목록 - 동적 콘텐츠 - Intlayer - 국제화 slugs: - doc - concept - collections history: - version: 9.0.0 date: 2026-06-12 changes: "컬렉션 사전 기능 출시" author: aymericzip --- # 컬렉션 **컬렉션**(Collection)은 동일한 사전 키(`key`)를 공유하지만 서로 다른 `item` 인덱스를 선언하는 콘텐츠 파일의 집합입니다. Intlayer는 빌드 시 이를 하나의 정렬된 목록으로 병합합니다. ## 컬렉션 항목 선언 각 파일은 하나의 항목을 나타냅니다. `item` 필드는 목록에서의 해당 위치입니다(1부터 시작). ```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; ``` ## 컬렉션 소비하기 ### 모든 항목 ```tsx fileName="FAQ.tsx" import { useIntlayer } from "react-intlayer"; export const FAQ = () => { const items = useIntlayer("faq"); // { question: string; answer: string }[] return ( ); }; ``` ```tsx fileName="FAQ.tsx" import { useIntlayer } from "next-intlayer"; export const FAQ = () => { const items = useIntlayer("faq"); // { question: string; answer: string }[] return ( ); }; ``` ```vue fileName="FAQ.vue" ``` ```svelte fileName="FAQ.svelte" ``` ```tsx fileName="FAQ.tsx" import { useIntlayer } from "preact-intlayer"; export const FAQ = () => { const items = useIntlayer("faq"); // { question: string; answer: string }[] return ( ); }; ``` ```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 ( ); }; ``` ```typescript fileName="faq.component.ts" import { Component } from "@angular/core"; import { useIntlayer } from "angular-intlayer"; @Component({ selector: "app-faq", template: ` `, }) export class FAQComponent { items = useIntlayer("faq"); } ``` ```javascript fileName="faq.js" import { useIntlayer } from "vanilla-intlayer"; const faq = useIntlayer("faq"); faq.forEach((item) => { console.log(item.question); console.log(item.answer); }); ``` ### 인덱스로 단일 항목 가져오기 ```tsx const faq2 = useIntlayer("faq", { item: 2 }); // → { question: string; answer: string } ``` ### 명시적 로케일로 단일 항목 가져오기 ```tsx const faq2Ko = useIntlayer("faq", { item: 2, locale: "ko" }); ``` ## 일반적인 사용 사례 - FAQ 목록 - 가격 책정 단계 / 요금제 목록 - 캐러셀 / 슬라이더용 슬라이드 콘텐츠 - 단계별 안내 지침