\n\n \n ```\n\n \n \n ```svelte fileName=\"Hero.svelte\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n \n\n
\n

{$content.headline}

\n {$content.cta}\n
\n ```\n\n
\n \n ```tsx fileName=\"Hero.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"preact-intlayer\";\n\n export const Hero = () => {\n const { headline, cta } = useIntlayer(\"hero-banner\");\n // → 기본 변형\n\n return (\n
\n

{headline}

\n {cta}\n
\n );\n };\n ```\n\n
\n \n ```tsx fileName=\"Hero.tsx\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\n import { useIntlayer } from \"solid-intlayer\";\n\n export const Hero = () => {\n const content = useIntlayer(\"hero-banner\");\n // → 기본 변형\n\n return (\n
\n

{content().headline}

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

{{ content().headline }}

\n {{ content().cta }}\n
\n `,\n })\n export class HeroComponent {\n content = useIntlayer(\"hero-banner\");\n }\n ```\n\n
\n \n ```javascript fileName=\"hero.js\"\n import { useIntlayer } from \"vanilla-intlayer\";\n\n const { headline, cta } = useIntlayer(\"hero-banner\");\n\n document.body.innerHTML = `\n
\n

${headline}

\n ${cta}\n
\n `;\n ```\n\n
\n\n\n### 이름이 지정된 변형\n\n```tsx\nconst { headline, cta } = useIntlayer(\"hero-banner\", {\n variant: \"black_friday\",\n});\n```\n\n### 명시적 로케일로 이름이 지정된 변형\n\n```tsx\nconst content = useIntlayer(\"hero-banner\", {\n variant: \"black_friday\",\n locale: \"ko\",\n});\n```\n\n## 일반적인 사용 사례\n\n- 실험 키(experiment key)에 따른 A/B 카피 테스트\n- 시즌별 또는 프로모션 배너\n- 기능 플래그(feature flags)로 제어되는 문구\n- 특정 로케일 타겟 마케팅 캠페인\n","description":"코드 변경 없이 런타임에 서로 전환할 수 있는 이름이 지정된 대체 콘텐츠(A/B 테스트, 시즌별 배너, 기능 플래그가 지정된 텍스트)를 선언하기 위해 Intlayer 콘텐츠 파일에서 variant 메타데이터 필드를 사용합니다.","url":"https://intlayer.org/ko/doc/concept/variants","datePublished":"2026-06-12","dateModified":"2026-06-12","version":"9.0.0","keywords":"변형, A/B 테스트, 기능 플래그, 동적 콘텐츠, Intlayer, 국제화","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"개발자, 콘텐츠 관리자"}}
    작가:
    생성:2026-06-12마지막 업데이트:2026-06-12

    변형

    변형(Variant)은 동일한 사전 키(key)를 공유하지만 서로 다른 variant 이름을 선언하는 콘텐츠 파일의 집합입니다. Intlayer는 useIntlayer에 전달된 선택기에 따라 적절한 파일을 서비스합니다.

    변형 선언

    각 파일은 하나의 이름이 지정된 대체 콘텐츠를 나타냅니다. variant 필드를 생략하거나 "default"로 설정하면 기본(fallback) 변형으로 표시됩니다.

    hero-banner.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "hero-banner",
      variant: "default",
      content: {
        headline: t({
          en: "Build faster with Intlayer",
          fr: "Développez plus vite avec Intlayer",
        }),
        cta: t({ en: "Get started", fr: "Commencer" }),
      },
    } satisfies Dictionary;
    
    export default dictionary;
    hero-banner.black-friday.content.ts
    import { t, type Dictionary } from "intlayer";
    
    const dictionary = {
      key: "hero-banner",
      variant: "black_friday",
      content: {
        headline: t({
          en: "50 % off — today only",
          fr: "−50 % — aujourd'hui seulement",
        }),
        cta: t({ en: "Shop now", fr: "Acheter maintenant" }),
      },
    } satisfies Dictionary;
    
    export default dictionary;

    변형 소비하기

    기본 변형

    Hero.tsx
    import { useIntlayer } from "react-intlayer";
    
    export const Hero = () => {
      const { headline, cta } = useIntlayer("hero-banner");
      // → 기본 변형
    
      return (
        <section>
          <h1>{headline}</h1>
          <a>{cta}</a>
        </section>
      );
    };

    이름이 지정된 변형

    tsx
    const { headline, cta } = useIntlayer("hero-banner", {  variant: "black_friday",});

    명시적 로케일로 이름이 지정된 변형

    tsx
    const content = useIntlayer("hero-banner", {  variant: "black_friday",  locale: "ko",});

    일반적인 사용 사례

    • 실험 키(experiment key)에 따른 A/B 카피 테스트
    • 시즌별 또는 프로모션 배너
    • 기능 플래그(feature flags)로 제어되는 문구
    • 특정 로케일 타겟 마케팅 캠페인