@intlayer/docs 7.0.4-canary.0 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/intlayer_with_i18next.md +68 -106
- package/blog/ar/intlayer_with_next-i18next.md +84 -288
- package/blog/ar/intlayer_with_next-intl.md +58 -337
- package/blog/ar/intlayer_with_react-i18next.md +68 -290
- package/blog/ar/intlayer_with_react-intl.md +63 -266
- package/blog/de/intlayer_with_i18next.md +77 -97
- package/blog/de/intlayer_with_next-i18next.md +69 -296
- package/blog/de/intlayer_with_next-intl.md +59 -340
- package/blog/de/intlayer_with_react-i18next.md +68 -290
- package/blog/de/intlayer_with_react-intl.md +62 -264
- package/blog/en/intlayer_with_i18next.md +36 -1638
- package/blog/en/intlayer_with_next-i18next.md +22 -847
- package/blog/en/intlayer_with_next-intl.md +32 -1053
- package/blog/en/intlayer_with_react-i18next.md +38 -764
- package/blog/en/intlayer_with_react-intl.md +42 -1018
- package/blog/en-GB/intlayer_with_i18next.md +67 -103
- package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
- package/blog/en-GB/intlayer_with_next-intl.md +58 -337
- package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
- package/blog/en-GB/intlayer_with_react-intl.md +61 -264
- package/blog/es/intlayer_with_i18next.md +67 -103
- package/blog/es/intlayer_with_next-i18next.md +71 -296
- package/blog/es/intlayer_with_next-intl.md +57 -338
- package/blog/es/intlayer_with_react-i18next.md +68 -290
- package/blog/es/intlayer_with_react-intl.md +62 -265
- package/blog/fr/intlayer_with_i18next.md +66 -104
- package/blog/fr/intlayer_with_next-i18next.md +82 -285
- package/blog/fr/intlayer_with_next-intl.md +57 -338
- package/blog/fr/intlayer_with_react-i18next.md +67 -289
- package/blog/fr/intlayer_with_react-intl.md +61 -264
- package/blog/hi/intlayer_with_i18next.md +68 -104
- package/blog/hi/intlayer_with_next-i18next.md +74 -299
- package/blog/hi/intlayer_with_next-intl.md +57 -239
- package/blog/hi/intlayer_with_react-i18next.md +69 -291
- package/blog/hi/intlayer_with_react-intl.md +65 -268
- package/blog/id/intlayer_with_i18next.md +126 -0
- package/blog/id/intlayer_with_next-i18next.md +142 -0
- package/blog/id/intlayer_with_next-intl.md +113 -0
- package/blog/id/intlayer_with_react-i18next.md +124 -0
- package/blog/id/intlayer_with_react-intl.md +122 -0
- package/blog/it/intlayer_with_i18next.md +67 -103
- package/blog/it/intlayer_with_next-i18next.md +71 -296
- package/blog/it/intlayer_with_next-intl.md +57 -338
- package/blog/it/intlayer_with_react-i18next.md +68 -290
- package/blog/it/intlayer_with_react-intl.md +62 -265
- package/blog/ja/intlayer_with_i18next.md +68 -103
- package/blog/ja/intlayer_with_next-i18next.md +85 -283
- package/blog/ja/intlayer_with_next-intl.md +58 -336
- package/blog/ja/intlayer_with_react-i18next.md +68 -290
- package/blog/ja/intlayer_with_react-intl.md +62 -264
- package/blog/ko/intlayer_with_i18next.md +80 -96
- package/blog/ko/intlayer_with_next-i18next.md +85 -287
- package/blog/ko/intlayer_with_next-intl.md +68 -327
- package/blog/ko/intlayer_with_react-i18next.md +68 -290
- package/blog/ko/intlayer_with_react-intl.md +64 -266
- package/blog/pl/intlayer_with_i18next.md +126 -0
- package/blog/pl/intlayer_with_next-i18next.md +142 -0
- package/blog/pl/intlayer_with_next-intl.md +111 -0
- package/blog/pl/intlayer_with_react-i18next.md +124 -0
- package/blog/pl/intlayer_with_react-intl.md +122 -0
- package/blog/pt/intlayer_with_i18next.md +67 -103
- package/blog/pt/intlayer_with_next-i18next.md +72 -293
- package/blog/pt/intlayer_with_next-intl.md +57 -256
- package/blog/pt/intlayer_with_react-i18next.md +104 -78
- package/blog/pt/intlayer_with_react-intl.md +62 -266
- package/blog/ru/intlayer_with_i18next.md +66 -104
- package/blog/ru/intlayer_with_next-i18next.md +71 -296
- package/blog/ru/intlayer_with_next-intl.md +58 -337
- package/blog/ru/intlayer_with_react-i18next.md +68 -290
- package/blog/ru/intlayer_with_react-intl.md +62 -265
- package/blog/tr/intlayer_with_i18next.md +71 -107
- package/blog/tr/intlayer_with_next-i18next.md +72 -297
- package/blog/tr/intlayer_with_next-intl.md +58 -339
- package/blog/tr/intlayer_with_react-i18next.md +69 -291
- package/blog/tr/intlayer_with_react-intl.md +63 -285
- package/blog/vi/intlayer_with_i18next.md +126 -0
- package/blog/vi/intlayer_with_next-i18next.md +142 -0
- package/blog/vi/intlayer_with_next-intl.md +111 -0
- package/blog/vi/intlayer_with_react-i18next.md +124 -0
- package/blog/vi/intlayer_with_react-intl.md +122 -0
- package/blog/zh/intlayer_with_i18next.md +67 -102
- package/blog/zh/intlayer_with_next-i18next.md +72 -296
- package/blog/zh/intlayer_with_next-intl.md +58 -336
- package/blog/zh/intlayer_with_react-i18next.md +68 -290
- package/blog/zh/intlayer_with_react-intl.md +63 -106
- package/docs/ar/plugins/sync-json.md +244 -0
- package/docs/de/plugins/sync-json.md +244 -0
- package/docs/en/intlayer_cli.md +25 -0
- package/docs/en/intlayer_with_nextjs_14.md +2 -0
- package/docs/en/intlayer_with_nextjs_15.md +2 -0
- package/docs/en/intlayer_with_nextjs_16.md +2 -0
- package/docs/en/plugins/sync-json.md +1 -1
- package/docs/en-GB/plugins/sync-json.md +244 -0
- package/docs/es/plugins/sync-json.md +244 -0
- package/docs/fr/plugins/sync-json.md +244 -0
- package/docs/hi/plugins/sync-json.md +244 -0
- package/docs/id/plugins/sync-json.md +244 -0
- package/docs/it/plugins/sync-json.md +244 -0
- package/docs/ja/plugins/sync-json.md +244 -0
- package/docs/ko/plugins/sync-json.md +244 -0
- package/docs/pl/plugins/sync-json.md +244 -0
- package/docs/pt/plugins/sync-json.md +244 -0
- package/docs/ru/plugins/sync-json.md +244 -0
- package/docs/tr/plugins/sync-json.md +245 -0
- package/docs/vi/plugins/sync-json.md +244 -0
- package/docs/zh/plugins/sync-json.md +244 -0
- package/package.json +14 -14
|
@@ -1,367 +1,165 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-08-23
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-10-29
|
|
4
4
|
title: Intlayer와 next-i18next
|
|
5
|
-
description: Next.js
|
|
5
|
+
description: 포괄적인 Next.js 국제화 솔루션을 위해 Intlayer를 next-i18next와 통합하기
|
|
6
6
|
keywords:
|
|
7
7
|
- i18next
|
|
8
8
|
- next-i18next
|
|
9
9
|
- Intlayer
|
|
10
10
|
- 국제화
|
|
11
|
-
-
|
|
11
|
+
- 블로그
|
|
12
12
|
- Next.js
|
|
13
|
-
-
|
|
14
|
-
-
|
|
13
|
+
- 자바스크립트
|
|
14
|
+
- 리액트
|
|
15
15
|
slugs:
|
|
16
16
|
- blog
|
|
17
17
|
- intlayer-with-next-i18next
|
|
18
|
+
history:
|
|
19
|
+
- version: 7.0.0
|
|
20
|
+
date: 2025-10-29
|
|
21
|
+
changes: syncJSON 플러그인으로 변경 및 전면 개편
|
|
18
22
|
---
|
|
19
23
|
|
|
20
|
-
# Next.js 국제화
|
|
24
|
+
# next-i18next와 Intlayer를 활용한 Next.js 국제화(i18n)
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
## 목차
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
<TOC/>
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
- `i18next`의 경우 `resource`라고 명명된 콘텐츠 선언은 하나 이상의 언어로된 번역의 키-값 쌍을 포함하는 구조화된 JSON 객체입니다. 자세한 내용은 [i18next 문서](https://www.i18next.com/translation-function/essentials)를 참조하십시오.
|
|
28
|
-
- `Intlayer`의 경우 `content declaration file`이라고 명명된 콘텐츠 선언은 구조화된 데이터를 내보내는 JSON, JS 또는 TS 파일이 될 수 있습니다. 자세한 내용은 [Intlayer 문서](https://intlayer.org/fr/doc/concept/content)를 참조하십시오.
|
|
30
|
+
## next-i18next란 무엇인가?
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
**next-i18next**는 Next.js 애플리케이션을 위한 가장 인기 있는 국제화(i18n) 프레임워크 중 하나입니다. 강력한 **i18next** 생태계 위에 구축되어, Next.js 프로젝트에서 번역, 현지화, 언어 전환을 관리하는 포괄적인 솔루션을 제공합니다.
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
하지만 next-i18next에는 몇 가지 어려움이 있습니다:
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
- **복잡한 설정**: next-i18next를 설정하려면 여러 구성 파일과 서버 측 및 클라이언트 측 i18n 인스턴스의 신중한 설정이 필요합니다.
|
|
37
|
+
- **분산된 번역 파일**: 번역 파일이 일반적으로 컴포넌트와 별도의 디렉토리에 저장되어 일관성 유지가 어렵습니다.
|
|
38
|
+
- **수동 네임스페이스 관리**: 개발자가 네임스페이스를 수동으로 관리하고 번역 리소스가 제대로 로드되도록 해야 합니다.
|
|
39
|
+
- **제한된 타입 안전성**: TypeScript 지원은 추가 구성이 필요하며 번역에 대한 자동 타입 생성을 제공하지 않습니다.
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
## Intlayer란 무엇인가요?
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
**Intlayer**는 전통적인 i18n 솔루션의 단점을 해결하기 위해 설계된 혁신적이고 오픈 소스인 국제화 라이브러리입니다. Next.js 애플리케이션에서 콘텐츠 관리를 위한 현대적인 접근 방식을 제공합니다.
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
[next-i18next vs. next-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md) 블로그 게시물에서 next-intl과의 구체적인 비교를 확인하세요.
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
## 왜 Intlayer를 next-i18next와 결합해야 하나요?
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
Intlayer는 훌륭한 독립형 i18n 솔루션을 제공하지만(자세한 내용은 [Next.js 통합 가이드](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/intlayer_with_nextjs_16.md)를 참조하세요), 다음과 같은 여러 이유로 next-i18next와 결합하여 사용할 수 있습니다:
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
1. **기존 코드베이스**: 이미 구축된 next-i18next 구현이 있으며 Intlayer의 향상된 개발자 경험으로 점진적으로 마이그레이션하고자 할 때.
|
|
52
|
+
2. **레거시 요구사항**: 프로젝트가 기존 i18next 플러그인 또는 워크플로우와의 호환성을 필요로 할 때.
|
|
53
|
+
3. **팀 친숙도**: 팀이 next-i18next에 익숙하지만 더 나은 콘텐츠 관리를 원할 때.
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
└── src
|
|
51
|
-
└── components
|
|
52
|
-
└── MyComponent
|
|
53
|
-
├── index.content.ts # 콘텐츠 선언 파일
|
|
54
|
-
└── index.tsx
|
|
55
|
-
```
|
|
55
|
+
**이를 위해 Intlayer는 next-i18next의 어댑터로 구현되어 CLI 또는 CI/CD 파이프라인에서 JSON 번역 자동화, 번역 테스트 등 다양한 작업을 지원할 수 있습니다.**
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
.
|
|
59
|
-
└── src
|
|
60
|
-
└── components
|
|
61
|
-
└── MyComponent
|
|
62
|
-
├── index.content.mjs # 콘텐츠 선언 파일
|
|
63
|
-
└── index.mjx
|
|
64
|
-
```
|
|
57
|
+
이 가이드는 next-i18next와의 호환성을 유지하면서 Intlayer의 우수한 콘텐츠 선언 시스템을 활용하는 방법을 보여줍니다.
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
└── src
|
|
69
|
-
└── components
|
|
70
|
-
└── MyComponent
|
|
71
|
-
├── index.content.cjs # 콘텐츠 선언 파일
|
|
72
|
-
└── index.cjx
|
|
73
|
-
```
|
|
59
|
+
---
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
.
|
|
77
|
-
└── src
|
|
78
|
-
└── components
|
|
79
|
-
└── MyComponent
|
|
80
|
-
├── index.content.json # 콘텐츠 선언 파일
|
|
81
|
-
└── index.jsx
|
|
82
|
-
```
|
|
61
|
+
## next-i18next와 함께 Intlayer 설정 단계별 가이드
|
|
83
62
|
|
|
84
|
-
|
|
63
|
+
### 1단계: 의존성 설치
|
|
85
64
|
|
|
86
|
-
|
|
65
|
+
선호하는 패키지 관리자를 사용하여 필요한 패키지를 설치하세요:
|
|
87
66
|
|
|
88
67
|
```bash packageManager="npm"
|
|
89
|
-
npm install intlayer
|
|
68
|
+
npm install intlayer @intlayer/sync-json-plugin
|
|
90
69
|
```
|
|
91
70
|
|
|
92
|
-
```bash packageManager="
|
|
93
|
-
|
|
71
|
+
```bash packageManager="pnpm"
|
|
72
|
+
pnpm add intlayer @intlayer/sync-json-plugin
|
|
94
73
|
```
|
|
95
74
|
|
|
96
|
-
```bash packageManager="
|
|
97
|
-
|
|
75
|
+
```bash packageManager="yarn"
|
|
76
|
+
yarn add intlayer @intlayer/sync-json-plugin
|
|
98
77
|
```
|
|
99
78
|
|
|
100
|
-
|
|
79
|
+
**패키지 설명:**
|
|
101
80
|
|
|
102
|
-
|
|
81
|
+
- **intlayer**: 콘텐츠 선언 및 관리를 위한 핵심 라이브러리
|
|
82
|
+
- **next-intlayer**: 빌드 플러그인이 포함된 Next.js 통합 레이어
|
|
83
|
+
- **i18next**: 핵심 i18n 프레임워크
|
|
84
|
+
- **next-i18next**: i18next를 위한 Next.js 래퍼
|
|
85
|
+
- **i18next-resources-to-backend**: i18next를 위한 동적 리소스 로딩
|
|
86
|
+
- **@intlayer/sync-json-plugin**: Intlayer 콘텐츠 선언을 i18next JSON 형식으로 동기화하는 플러그인
|
|
103
87
|
|
|
104
|
-
|
|
88
|
+
### 2단계: JSON을 래핑하는 Intlayer 플러그인 구현
|
|
105
89
|
|
|
106
|
-
|
|
90
|
+
지원하는 로케일을 정의하기 위해 Intlayer 구성 파일을 만듭니다:
|
|
91
|
+
|
|
92
|
+
**i18next용 JSON 사전도 내보내고 싶다면**, `syncJSON` 플러그인을 추가하세요:
|
|
93
|
+
|
|
94
|
+
```typescript fileName="intlayer.config.ts"
|
|
107
95
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
96
|
+
import { syncJSON } from "@intlayer/sync-json-plugin";
|
|
108
97
|
|
|
109
98
|
const config: IntlayerConfig = {
|
|
110
99
|
internationalization: {
|
|
111
100
|
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
112
101
|
defaultLocale: Locales.ENGLISH,
|
|
113
102
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
plugins: [
|
|
104
|
+
syncJSON({
|
|
105
|
+
source: ({ key, locale }) => `./messages/${locale}/${key}.json`,
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
118
108
|
};
|
|
119
109
|
|
|
120
110
|
export default config;
|
|
121
111
|
```
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
import { Locales } from "intlayer";
|
|
113
|
+
`syncJSON` 플러그인은 JSON을 자동으로 래핑합니다. 콘텐츠 구조를 변경하지 않고 JSON 파일을 읽고 씁니다.
|
|
125
114
|
|
|
126
|
-
|
|
127
|
-
const config = {
|
|
128
|
-
internationalization: {
|
|
129
|
-
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
130
|
-
defaultLocale: Locales.ENGLISH,
|
|
131
|
-
},
|
|
132
|
-
content: {
|
|
133
|
-
dictionaryOutput: ["i18next"],
|
|
134
|
-
i18nextResourcesDir: "./i18next/resources",
|
|
135
|
-
},
|
|
136
|
-
};
|
|
115
|
+
JSON과 intlayer 콘텐츠 선언 파일(`.content` 파일)을 공존시키고 싶다면, Intlayer는 다음과 같이 처리합니다:
|
|
137
116
|
|
|
138
|
-
|
|
139
|
-
```
|
|
117
|
+
1. JSON과 콘텐츠 선언 파일을 모두 로드하여 intlayer 사전으로 변환합니다.
|
|
140
118
|
|
|
141
|
-
|
|
142
|
-
const { Locales } = require("intlayer");
|
|
119
|
+
2. JSON과 콘텐츠 선언 파일 간에 충돌이 있는 경우, Intlayer는 모든 사전을 병합하는 과정을 진행합니다. 플러그인의 우선순위와 콘텐츠 선언 파일의 우선순위에 따라 결정되며(모두 구성 가능합니다).
|
|
143
120
|
|
|
144
|
-
|
|
145
|
-
const config = {
|
|
146
|
-
internationalization: {
|
|
147
|
-
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
148
|
-
defaultLocale: Locales.ENGLISH,
|
|
149
|
-
},
|
|
150
|
-
content: {
|
|
151
|
-
dictionaryOutput: ["i18next"],
|
|
152
|
-
i18nextResourcesDir: "./i18next/resources",
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
module.exports = config;
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
여기서는 문서의 나머지 부분의 연속성과 수정을 제공하겠습니다:
|
|
121
|
+
CLI를 사용하여 JSON을 번역하거나 CMS를 통해 변경 사항이 발생하면, Intlayer는 새로운 번역으로 JSON 파일을 업데이트합니다.
|
|
160
122
|
|
|
161
123
|
---
|
|
162
124
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
생성된 리소스를 i18next 구성에 가져오려면 `i18next-resources-to-backend`를 사용하십시오. 아래는 예시입니다:
|
|
166
|
-
|
|
167
|
-
```typescript fileName="i18n/client.ts" codeFormat="typescript"
|
|
168
|
-
import i18next from "i18next";
|
|
169
|
-
import resourcesToBackend from "i18next-resources-to-backend";
|
|
170
|
-
|
|
171
|
-
i18next.use(
|
|
172
|
-
resourcesToBackend(
|
|
173
|
-
(language: string, namespace: string) =>
|
|
174
|
-
import(`../i18next/resources/${language}/${namespace}.json`)
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
```javascript fileName="i18n/client.mjs" codeFormat="esm"
|
|
180
|
-
import i18next from "i18next";
|
|
181
|
-
import resourcesToBackend from "i18next-resources-to-backend";
|
|
182
|
-
|
|
183
|
-
i18next.use(
|
|
184
|
-
resourcesToBackend(
|
|
185
|
-
(language, namespace) =>
|
|
186
|
-
import(`../i18next/resources/${language}/${namespace}.json`)
|
|
187
|
-
)
|
|
188
|
-
);
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
```javascript fileName="i18n/client.cjs" codeFormat="commonjs"
|
|
192
|
-
const i18next = require("i18next");
|
|
193
|
-
const resourcesToBackend = require("i18next-resources-to-backend");
|
|
194
|
-
|
|
195
|
-
i18next.use(
|
|
196
|
-
resourcesToBackend(
|
|
197
|
-
(language, namespace) =>
|
|
198
|
-
import(`../i18next/resources/${language}/${namespace}.json`)
|
|
199
|
-
)
|
|
200
|
-
);
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### 콘텐츠 선언
|
|
204
|
-
|
|
205
|
-
다양한 형식의 콘텐츠 선언 파일 예시:
|
|
206
|
-
|
|
207
|
-
```typescript fileName="**/*.content.ts" contentDeclarationFormat="typescript"
|
|
208
|
-
import { t, type Dictionary } from "intlayer";
|
|
125
|
+
## Git 구성
|
|
209
126
|
|
|
210
|
-
|
|
211
|
-
key: "my-content",
|
|
212
|
-
content: {
|
|
213
|
-
myTranslatedContent: t({
|
|
214
|
-
en: "Hello World",
|
|
215
|
-
es: "Hola Mundo",
|
|
216
|
-
fr: "Bonjour le monde",
|
|
217
|
-
}),
|
|
218
|
-
},
|
|
219
|
-
} satisfies Dictionary;
|
|
220
|
-
|
|
221
|
-
export default content;
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
225
|
-
import { t } from "intlayer";
|
|
226
|
-
|
|
227
|
-
/** @type {import('intlayer').Dictionary} */
|
|
228
|
-
const content = {
|
|
229
|
-
key: "my-content",
|
|
230
|
-
content: {
|
|
231
|
-
myTranslatedContent: t({
|
|
232
|
-
en: "Hello World",
|
|
233
|
-
es: "Hola Mundo",
|
|
234
|
-
fr: "Bonjour le monde",
|
|
235
|
-
}),
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
241
|
-
const { t } = require("intlayer");
|
|
127
|
+
생성된 파일을 버전 관리에서 제외하세요:
|
|
242
128
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
en: "Hello World",
|
|
248
|
-
es: "Hola Mundo",
|
|
249
|
-
fr: "Bonjour le monde",
|
|
250
|
-
}),
|
|
251
|
-
},
|
|
252
|
-
};
|
|
129
|
+
```plaintext fileName=".gitignore"
|
|
130
|
+
# Intlayer에서 생성된 파일 무시
|
|
131
|
+
.intlayer
|
|
132
|
+
intl
|
|
253
133
|
```
|
|
254
134
|
|
|
255
|
-
|
|
256
|
-
{
|
|
257
|
-
"$schema": "https://intlayer.org/schema.json",
|
|
258
|
-
"key": "my-content",
|
|
259
|
-
"content": {
|
|
260
|
-
"myTranslatedContent": {
|
|
261
|
-
"nodeType": "translation",
|
|
262
|
-
"translation": {
|
|
263
|
-
"en": "Hello World",
|
|
264
|
-
"fr": "Bonjour le monde",
|
|
265
|
-
"es": "Hola Mundo"
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
```
|
|
135
|
+
이 파일들은 빌드 과정에서 자동으로 다시 생성되므로 저장소에 커밋할 필요가 없습니다.
|
|
271
136
|
|
|
272
|
-
###
|
|
137
|
+
### VS Code 확장 프로그램
|
|
273
138
|
|
|
274
|
-
|
|
139
|
+
개발자 경험 향상을 위해 공식 **Intlayer VS Code 확장 프로그램**을 설치하세요:
|
|
275
140
|
|
|
276
|
-
|
|
277
|
-
npx run intlayer build
|
|
278
|
-
```
|
|
141
|
+
[VS Code 마켓플레이스에서 설치하기](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
279
142
|
|
|
280
|
-
|
|
281
|
-
yarn intlayer build
|
|
282
|
-
```
|
|
143
|
+
2. JSON과 콘텐츠 선언 파일 간에 충돌이 있는 경우, Intlayer는 모든 사전을 병합하는 작업을 수행합니다. 플러그인의 우선순위와 콘텐츠 선언 파일의 우선순위에 따라 처리됩니다(모두 구성 가능합니다).
|
|
283
144
|
|
|
284
|
-
|
|
285
|
-
pnpm intlayer build
|
|
286
|
-
```
|
|
145
|
+
CLI를 사용하여 JSON 번역을 변경하거나 CMS를 사용하여 변경하는 경우, Intlayer는 새 번역으로 JSON 파일을 업데이트합니다.
|
|
287
146
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
.
|
|
292
|
-
└── i18next
|
|
293
|
-
└── resources
|
|
294
|
-
└── en
|
|
295
|
-
└── my-content.json
|
|
296
|
-
└── fr
|
|
297
|
-
└── my-content.json
|
|
298
|
-
└── es
|
|
299
|
-
└── my-content.json
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
노트: i18next 네임스페이스는 Intlayer 선언 키에 해당합니다.
|
|
303
|
-
|
|
304
|
-
### Next.js 플러그인 구현
|
|
305
|
-
|
|
306
|
-
구성이 완료되면 Intlayer 콘텐츠 선언 파일이 업데이트될 때마다 i18next 리소스를 다시 빌드하기 위해 Next.js 플러그인을 구현합니다.
|
|
307
|
-
|
|
308
|
-
```typescript fileName="next.config.mjs"
|
|
309
|
-
import { withIntlayer } from "next-intlayer/server";
|
|
310
|
-
|
|
311
|
-
/** @type {import('next').NextConfig} */
|
|
312
|
-
const nextConfig = {};
|
|
313
|
-
|
|
314
|
-
export default withIntlayer(nextConfig);
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
### Next.js 컴포넌트에서 콘텐츠 사용하기
|
|
318
|
-
|
|
319
|
-
Next.js 플러그인을 구현한 후에는 컴포넌트에서 콘텐츠를 사용할 수 있습니다:
|
|
320
|
-
|
|
321
|
-
```typescript fileName="src/components/myComponent/index.tsx" codeFormat="typescript"
|
|
322
|
-
import type { FC } from "react";
|
|
323
|
-
import { useTranslation } from "react-i18next";
|
|
147
|
+
---
|
|
324
148
|
|
|
325
|
-
|
|
326
|
-
const { t } = useTranslation();
|
|
149
|
+
## Git 구성
|
|
327
150
|
|
|
328
|
-
|
|
329
|
-
<div>
|
|
330
|
-
<h1>{t("my-content.title")}</h1>
|
|
331
|
-
<p>{t("my-content.description")}</p>
|
|
332
|
-
</div>
|
|
333
|
-
);
|
|
334
|
-
};
|
|
151
|
+
버전 관리에서 생성된 파일 제외:
|
|
335
152
|
|
|
336
|
-
|
|
153
|
+
```plaintext fileName=".gitignore"
|
|
154
|
+
# Intlayer에서 생성된 파일 무시
|
|
155
|
+
.intlayer
|
|
156
|
+
intl
|
|
337
157
|
```
|
|
338
158
|
|
|
339
|
-
|
|
340
|
-
import { useTranslation } from "react-i18next";
|
|
159
|
+
이 파일들은 빌드 과정에서 자동으로 다시 생성되므로 저장소에 커밋할 필요가 없습니다.
|
|
341
160
|
|
|
342
|
-
|
|
343
|
-
const { t } = useTranslation();
|
|
161
|
+
### VS Code 확장 프로그램
|
|
344
162
|
|
|
345
|
-
|
|
346
|
-
<div>
|
|
347
|
-
<h1>{t("my-content.title")}</h1>
|
|
348
|
-
<p>{t("my-content.description")}</p>
|
|
349
|
-
</div>
|
|
350
|
-
);
|
|
351
|
-
};
|
|
352
|
-
```
|
|
163
|
+
개발자 경험 향상을 위해 공식 **Intlayer VS Code 확장 프로그램**을 설치하세요:
|
|
353
164
|
|
|
354
|
-
|
|
355
|
-
const { useTranslation } = require("react-i18next");
|
|
356
|
-
|
|
357
|
-
const IndexPage = () => {
|
|
358
|
-
const { t } = useTranslation();
|
|
359
|
-
|
|
360
|
-
return (
|
|
361
|
-
<div>
|
|
362
|
-
<h1>{t("my-content.title")}</h1>
|
|
363
|
-
<p>{t("my-content.description")}</p>
|
|
364
|
-
</div>
|
|
365
|
-
);
|
|
366
|
-
};
|
|
367
|
-
```
|
|
165
|
+
[VS Code 마켓플레이스에서 설치하기](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|