홈샌드박스쇼케이스앱문서블로그
    • English영어
      EN
    • русский러시아어
      RU
    • 日本語일본어
      JA
    • français프랑스어
      FR
    • 한국어한국어
      KO
    • 中文중국어
      ZH
    • español스페인어
      ES
    • Deutsch독일어
      DE
    • العربية아랍어
      AR
    • italiano이탈리아어
      IT
    • British English영어(영국)
      EN-GB
    • português포르투갈어
      PT
    • हिन्दी힌디어
      HI
    • Türkçe튀르키예어
      TR
    • polski폴란드어
      PL
    • Indonesia인도네시아어
      ID
    • Tiếng Việt베트남어
      VI
    • українська우크라이나어
      UK
    /
    프레임워크로 문서 필터링
    Alt+←
    Intlayer의 이점
    시작하기
    개념
    • Intlayer 작동 방식
    • 구성
    • TestFillBuildWatchExtractLoginPushPullConfigurationListVersionEditorLiveDebugDoc ReviewDoc TranslateSDK
    • 비주얼 편집기
    • CMS
    • CI/CD 통합
    • 번역복수형열거조건성별삽입파일중첩MarkdownHTML함수 가져오기
    • 로케일별 파일
    • 컴파일러
    • 자동 채우기
    • 테스트
    • 번들 최적화
    환경
    • Next.js 14 및 앱 라우터
      Next.js 15
      Next.js 로케일 없는 URL
      Next.js 및 페이지 라우터
      컴파일러
    • Tanstack Start Solid
    • Astro 및 React
      Astro 및 Svelte
      Astro 및 Vue
      Astro 및 Solid
      Astro 및 Preact
      Astro 및 Lit
      Astro 및 Vanilla JS
    • React Router v7
      React Router v7 (fs-routes)
      Compiler
    • Nuxt 및 Vue
    • Vite 및 Solid
    • SvelteKit
    • Vite 및 Preact
    • Vite 및 Vanilla JS
    • Vite 및 Lit
    • Angular 19 (Webpack)
      Analog
    • React CRA
    • React Native 및 Expo
    • Express.js
      NestJS
      Fastify
      Hono
      Adonis
    • Lynx 및 React
    Plugins
    • JSON
    • gettext (.po)
    VS Code 확장 기능
    에이전트
    • MCP 서버
    • 에이전트 기술
    릴리스
    • v8
    • v7
    • v6
    벤치마크
    • Next.js
    • TanStack
    • Vue
    • Solid
    • Svelte
    블로그
    질문 발표
    1. Documentation
    2. 개념
    3. 로케일별 파일
    생성:2025-04-18마지막 업데이트:2025-06-29
    이 문서를 원하는 AI 어시스턴트에 참조하세요
    ChatGPT
    Claude
    DeepSeek
    Google AI mode
    Gemini
    Perplexity
    Mistral
    Grok

    이 페이지와 원하는 AI 어시스턴트를 사용하여 문서를 요약합니다

    버전 기록

    1. "초기 이력"
      v5.5.102025. 6. 29.

    이 페이지의 콘텐츠는 AI를 사용하여 번역되었습니다.

    영어 원본 내용의 최신 버전을 보기
    문서 수정

    이 문서를 개선할 아이디어가 있으시면 GitHub에 풀 리퀘스트를 제출하여 자유롭게 기여해 주세요.

    문서에 대한 GitHub 링크
    복사

    문서의 Markdown을 클립보드에 복사

    Intlayer에서 지역별 콘텐츠 선언 방법

    Intlayer는 다국어 콘텐츠를 선언하는 두 가지 방식을 지원합니다:

    • 모든 번역을 포함한 단일 파일
    • 지역별로 하나씩 파일을 나누는 방식 (지역별 형식)

    이 유연성은 다음을 가능하게 합니다:

    • 다른 i18n 도구에서의 손쉬운 마이그레이션
    • 자동 번역 워크플로우 지원
    • 번역을 별도의 지역별 파일로 명확하게 조직화

    여러 번역을 포함한 단일 파일

    이 형식은 다음에 적합합니다:

    • 코드 내 빠른 반복 작업
    • CMS와의 원활한 통합

    대부분의 사용 사례에 권장되는 접근 방식입니다. 번역을 중앙 집중화하여 반복 작업과 CMS 통합을 쉽게 만듭니다.

    hello-world.content.ts
    코드 복사

    코드를 클립보드에 복사

    import { t, type Dictionary } from "intlayer";
    
    const helloWorldContent = {
      key: "hello-world",
      content: {
        multilingualContent: t({
          en: "Title of my component",
          es: "Título de mi componente",
        }),
      },
    } satisfies Dictionary;
    
    export default helloWorldContent;
    권장: 이 형식은 Intlayer의 시각적 편집기를 사용하거나 코드 내에서 직접 번역을 관리할 때 가장 적합합니다.

    로케일별 파일에 대한 전역 설정

    intlayer.config.ts 파일에 다음을 추가하여 로케일별 파일에 대한 전역 설정을 구성할 수 있습니다:

    ts
    코드 복사

    코드를 클립보드에 복사

    import { Locales, type IntlayerConfig } from "intlayer";const config: IntlayerConfig = {  dictionary: {    locale: Locales.ENGLISH,  },};export default config;

    이 구성을 사용하면 모든 로케일별 파일이 기본 로케일이 영어로 설정된 상태로 생성됩니다. 또한 extract 명령어와 컴파일러를 사용한 .content 파일 생성도 포함됩니다. (자세한 내용은 Compiler 또는 Extract를 참조하세요.)

    로케일별 형식

    이 형식은 다음과 같은 경우에 유용합니다:

    • 번역을 독립적으로 버전 관리하거나 재정의하려는 경우.
    • 기계 번역 또는 인간 번역 워크플로우를 통합하는 경우.

    로케일 필드를 지정하여 번역을 개별 로케일 파일로 분리할 수도 있습니다:

    hello-world.es.content.ts
    코드 복사

    코드를 클립보드에 복사

    import { t, Locales, type Dictionary } from "intlayer";
    
    const helloWorldContent = {
      key: "hello-world",
      locale: Locales.SPANISH, // 중요
      content: { multilingualContent: "Título de mi componente" },
    } satisfies Dictionary;
    
    export default helloWorldContent;
    중요: locale 필드가 정의되어 있는지 반드시 확인하세요. 이 필드는 Intlayer에 해당 파일이 어떤 언어를 나타내는지 알려줍니다.
    참고: 두 경우 모두, 콘텐츠 선언 파일은 Intlayer에서 인식되기 위해 *.content.{ts,tsx,js,jsx,mjs,cjs,json} 명명 패턴을 따라야 합니다. .[locale] 접미사는 선택 사항이며 명명 규칙으로만 사용됩니다.

    형식 혼합

    동일한 콘텐츠 키에 대해 두 가지 선언 방식을 결합할 수 있습니다. 예를 들어:

    • index.content.ts와 같은 파일에서 기본 콘텐츠를 정적으로 선언합니다.
    • index.fr.content.ts 또는 index.content.json과 같은 별도의 파일에서 특정 번역을 추가하거나 덮어씁니다.

    이 설정은 특히 다음과 같은 경우에 유용합니다:

    • 코드에서 초기 콘텐츠 구조를 정의하려는 경우.
    • 나중에 CMS 또는 자동화 도구를 사용하여 번역을 보완하거나 완성하려는 경우.
    bash
    코드 복사

    코드를 클립보드에 복사

    .└── Components    └── MyComponent        ├── index.content.ts        ├── index.content.json        └── index.ts

    예시

    다국어 콘텐츠 선언 파일 예시:

    Components/MyComponent/index.content.ts
    코드 복사

    코드를 클립보드에 복사

    import { t, type Dictionary } from "intlayer";const helloWorldContent = {  key: "hello-world",  locale: Locales.ENGLISH,  content: {    multilingualContent: "내 컴포넌트의 제목",    projectName: "내 프로젝트",  },} satisfies Dictionary;export default helloWorldContent;
    Components/MyComponent/index.content.json
    코드 복사

    코드를 클립보드에 복사

    {  "$schema": "https://intlayer.org/schema.json",  "key": "hello-world",  "content": {    "multilingualContent": {      "nodeType": "translation",      "translation": {        "fr": "Titre de mon composant",        "es": "Título de mi componente"      }    }  }}

    Intlayer는 다국어 및 로케일별 파일을 자동으로 병합합니다.

    Components/MyComponent/index.ts
    코드 복사

    코드를 클립보드에 복사

    import { getIntlayer, Locales } from "intlayer";const intlayer = getIntlayer("hello-world"); // 기본 로케일은 ENGLISH이므로 ENGLISH 콘텐츠를 반환합니다.console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "내 컴포넌트의 제목",//  "projectName": "내 프로젝트"// }const intlayer = getIntlayer("hello-world", Locales.SPANISH);console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "Título de mi componente",//  "projectName": "내 프로젝트"// }const intlayer = getIntlayer("hello-world", Locales.FRENCH);console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "Titre de mon composant",//  "projectName": "내 프로젝트"// }

    자동 번역 생성

    intlayer CLI를 사용하여 선호하는 서비스를 기반으로 누락된 번역을 자동으로 채우세요.

    함수 가져오기
    컴파일러
    Alt+→

    이 페이지에서

      토론은 익명이며 일반적인 문제를 해결하기 위해 정기적으로 검토됩니다. 기능 아이디어, 문서에 대한 피드백 또는 Intlayer와 관련된 모든 것을 자유롭게 공유하세요, 이 의견을 로드맵 구성과 제품 개선에 활용합니다.

      import { Locales, type IntlayerConfig } from "intlayer";const config: IntlayerConfig = {  dictionary: {    locale: Locales.ENGLISH,  },};export default config;
      .└── Components    └── MyComponent        ├── index.content.ts        ├── index.content.json        └── index.ts
      import { t, type Dictionary } from "intlayer";const helloWorldContent = {  key: "hello-world",  locale: Locales.ENGLISH,  content: {    multilingualContent: "내 컴포넌트의 제목",    projectName: "내 프로젝트",  },} satisfies Dictionary;export default helloWorldContent;
      {  "$schema": "https://intlayer.org/schema.json",  "key": "hello-world",  "content": {    "multilingualContent": {      "nodeType": "translation",      "translation": {        "fr": "Titre de mon composant",        "es": "Título de mi componente"      }    }  }}
      import { getIntlayer, Locales } from "intlayer";const intlayer = getIntlayer("hello-world"); // 기본 로케일은 ENGLISH이므로 ENGLISH 콘텐츠를 반환합니다.console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "내 컴포넌트의 제목",//  "projectName": "내 프로젝트"// }const intlayer = getIntlayer("hello-world", Locales.SPANISH);console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "Título de mi componente",//  "projectName": "내 프로젝트"// }const intlayer = getIntlayer("hello-world", Locales.FRENCH);console.log(JSON.stringify(intlayer, null, 2));// 결과:// {//  "multilingualContent": "Titre de mon composant",//  "projectName": "내 프로젝트"// }