\n\n \n ```\n\n \n \n ```svelte fileName=\"ProductCopy.svelte\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n \n\n {#if $content}\n

{$content.description}

\n {/if}\n ```\n\n
\n \n ```tsx fileName=\"ProductCopy.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"preact-intlayer\";\n\n export const ProductCopy = ({\n productId,\n userId,\n }: {\n productId: string;\n userId: string;\n }) => {\n const content = useIntlayer(\"product-copy\", { id: productId, userId });\n // TypeScript는 `id`와 `userId`가 모두 제공되었는지 검사합니다.\n\n if (!content) return null;\n\n return

{content.description}

;\n };\n ```\n\n
\n \n ```tsx fileName=\"ProductCopy.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"solid-intlayer\";\n\n export const ProductCopy = (props: {\n productId: string;\n userId: string;\n }) => {\n const content = useIntlayer(\"product-copy\", { id: props.productId, userId: props.userId });\n // TypeScript는 `id`와 `userId`가 모두 제공되었는지 검사합니다.\n\n return (\n <>\n {content() &&

{content().description}

}\n \n );\n };\n ```\n\n
\n \n ```typescript fileName=\"product-copy.component.ts\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { Component, Input, OnInit } from \"@angular/core\";\n import { useIntlayer } from \"angular-intlayer\";\n\n @Component({\n selector: \"app-product-copy\",\n template: `\n @if (content()) {\n

{{ content().description }}

\n }\n `,\n })\n export class ProductCopyComponent implements OnInit {\n @Input() productId!: string;\n @Input() userId!: string;\n\n content: any;\n\n ngOnInit() {\n this.content = useIntlayer(\"product-copy\", { id: this.productId, userId: this.userId });\n }\n }\n ```\n\n
\n \n ```javascript fileName=\"product-copy.js\"\n import { useIntlayer } from \"vanilla-intlayer\";\n\n const content = useIntlayer(\"product-copy\", {\n id: \"prod_abcd\",\n userId: \"user_123\"\n });\n\n if (content) {\n document.body.innerHTML = `

${content.description}

`;\n }\n ```\n\n
\n\n\n### 명시적 로케일 사용 시\n\n```tsx\nconst content = useIntlayer(\"product-copy\", {\n id: \"prod_abc\",\n userId: \"user_123\",\n locale: \"ko\",\n});\n```\n\n### 필수 meta 필드 누락 — 컴파일 오류\n\n```ts\n// 타입 오류: `userId` 누락\nconst content = useIntlayer(\"product-copy\", { id: \"prod_abc\" });\n```\n\n## 로딩 모드 (loading mode)\n\n동적 레코드는 일반적으로 지연 로드됩니다. 이를 제어하려면 사전에 `importMode`를 설정합니다.\n\n```ts contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\nconst dictionary = {\n key: \"product-copy\",\n importMode: \"fetch\", // 또는 \"dynamic\"\n meta: { id: \"prod_abc\", userId: \"user_123\" },\n content: { … },\n} satisfies Dictionary;\n\nexport default dictionary;\n```\n\n`static`, `dynamic`, `fetch` 모드에 대한 자세한 내용은 [번들 최적화](/ko/doc/concept/bundle-optimization)를 참조하세요.\n\n## 일반적인 사용 사례\n\n- CMS에서 관리하는 제품별 마케팅 문구\n- 사용자별 또는 계정별 맞춤 콘텐츠\n- 불투명한 런타임 ID로 식별되는 임의의 콘텐츠\n","description":"불투명한 ID로 런타임에 가져오는 CMS 관리형 레코드를 선언하기 위해 Intlayer 콘텐츠 파일에서 meta 필드를 사용합니다. 이를 통해 빌드 시점의 열거 없이 강력한 형식의 동적 콘텐츠를 지원합니다.","url":"https://intlayer.org/ko/doc/concept/dynamic-records","datePublished":"2026-06-12","dateModified":"2026-06-12","version":"9.0.0","keywords":"동적 레코드, 동적 콘텐츠, CMS, 런타임 콘텐츠, Intlayer, 국제화","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"개발자, 콘텐츠 관리자"}}
    작가:
    생성:2026-06-12마지막 업데이트:2026-06-12

    동적 레코드

    동적 레코드(dynamic record)는 고유 식별자가 순차적 인덱스나 이름이 지정된 변형이 아니라, meta 필드에 선언된 임의의 키-값 쌍의 집합인 콘텐츠 파일입니다. Intlayer는 런타임 시 이 필드들을 선택기로 사용하여 CMS 레코드, 사용자 특정 텍스트 또는 빌드 시점에 키를 알 수 없는 임의의 콘텐츠에 접근할 수 있게 합니다.

    동적 레코드 선언

    product-copy.abc.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "product-copy",
      meta: {
        id: "prod_abc",
        userId: "user_123",
      },
      content: {
        name: t({ en: "Widget Pro", fr: "Widget Pro" }),
        description: t({ en: "The best widget.", fr: "Le meilleur widget." }),
      },
    } satisfies Dictionary;
    
    export default dictionary;
    product-copy.abcd.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "product-copy",
      meta: {
        id: "prod_abcd",
        userId: "user_123",
      },
      content: {
        name: t({ en: "Widget Lite", fr: "Widget Lite" }),
        description: t({ en: "A lighter option.", fr: "Une option plus légère." }),
      },
    } satisfies Dictionary;
    
    export default dictionary;

    동적 레코드 소비하기

    선택기에서 모든 meta 필드는 필수입니다. 일부 필드를 누락하면 null이 반환되며 TypeScript 오류가 발생합니다.

    ProductCopy.tsx
    import { useIntlayer } from "react-intlayer";
    
    export const ProductCopy = ({
      productId,
      userId,
    }: {
      productId: string;
      userId: string;
    }) => {
      const content = useIntlayer("product-copy", { id: productId, userId });
      // TypeScript는 `id`와 `userId`가 모두 제공되었는지 검사합니다.
    
      if (!content) return null;
    
      return <p>{content.description}</p>;
    };

    명시적 로케일 사용 시

    tsx
    const content = useIntlayer("product-copy", {  id: "prod_abc",  userId: "user_123",  locale: "ko",});

    필수 meta 필드 누락 — 컴파일 오류

    ts
    // 타입 오류: `userId` 누락const content = useIntlayer("product-copy", { id: "prod_abc" });

    로딩 모드 (loading mode)

    동적 레코드는 일반적으로 지연 로드됩니다. 이를 제어하려면 사전에 importMode를 설정합니다.

    ts
    const dictionary = {
      key: "product-copy",
      importMode: "fetch", // 또는 "dynamic"
      meta: { id: "prod_abc", userId: "user_123" },
      content: { … },
    } satisfies Dictionary;
    
    export default dictionary;

    static, dynamic, fetch 모드에 대한 자세한 내용은 번들 최적화를 참조하세요.

    일반적인 사용 사례

    • CMS에서 관리하는 제품별 마케팅 문구
    • 사용자별 또는 계정별 맞춤 콘텐츠
    • 불투명한 런타임 ID로 식별되는 임의의 콘텐츠