@intlayer/docs 6.1.4 → 6.1.6-canary.0
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/next-i18next_vs_next-intl_vs_intlayer.md +1366 -75
- package/blog/ar/nextjs-multilingual-seo-comparison.md +364 -0
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +1288 -72
- package/blog/de/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +583 -336
- package/blog/en/nextjs-multilingual-seo-comparison.md +360 -0
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +1144 -37
- package/blog/en-GB/nextjs-multilingual-seo-comparison.md +360 -0
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +1236 -64
- package/blog/es/nextjs-multilingual-seo-comparison.md +363 -0
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +1142 -75
- package/blog/fr/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/hi/nextjs-multilingual-seo-comparison.md +363 -0
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +1130 -55
- package/blog/it/nextjs-multilingual-seo-comparison.md +363 -0
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +1150 -76
- package/blog/ja/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +1139 -73
- package/blog/ko/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +1143 -76
- package/blog/pt/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +1150 -74
- package/blog/ru/nextjs-multilingual-seo-comparison.md +370 -0
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/tr/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +1152 -75
- package/blog/zh/nextjs-multilingual-seo-comparison.md +394 -0
- package/dist/cjs/generated/blog.entry.cjs +16 -0
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +16 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +16 -0
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +16 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts +1 -0
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- package/docs/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- package/docs/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- package/docs/en/interest_of_intlayer.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +18 -1
- package/docs/en/intlayer_with_nextjs_15.md +18 -1
- package/docs/en/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- package/docs/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- package/docs/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- package/docs/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- package/docs/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- package/docs/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- package/docs/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- package/docs/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- package/docs/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- package/docs/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- package/docs/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- package/docs/zh/vs_code_extension.md +51 -105
- package/package.json +11 -11
- package/src/generated/blog.entry.ts +16 -0
- package/src/generated/docs.entry.ts +16 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-17
|
|
3
|
-
updatedAt: 2025-09-
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
4
|
title: 공식 VS 코드 확장
|
|
5
|
-
description: VS 코드에서 Intlayer 확장을 사용하여 개발
|
|
5
|
+
description: VS 코드에서 Intlayer 확장을 사용하여 개발 워크플로우를 향상시키는 방법을 알아보세요. 현지화된 콘텐츠 간 빠른 탐색과 사전 관리를 효율적으로 수행할 수 있습니다.
|
|
6
6
|
keywords:
|
|
7
7
|
- VS 코드 확장
|
|
8
8
|
- Intlayer
|
|
@@ -23,161 +23,100 @@ slugs:
|
|
|
23
23
|
|
|
24
24
|
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)는 프로젝트에서 현지화된 콘텐츠 작업 시 개발자 경험을 향상시키기 위해 설계된 **Intlayer**의 공식 Visual Studio Code 확장입니다.
|
|
25
25
|
|
|
26
|
-

|
|
26
|
+

|
|
27
27
|
|
|
28
28
|
확장 링크: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
|
|
29
29
|
|
|
30
30
|
## 기능
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+

|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
**원활한 통합** – **react-intlayer** 및 **next-intlayer** 프로젝트와 문제없이 작동합니다.
|
|
36
|
-
**다국어 지원** – 다양한 언어의 현지화된 콘텐츠를 지원합니다.
|
|
37
|
-
**VS 코드 통합** – VS 코드의 탐색 및 명령 팔레트와 원활하게 통합됩니다.
|
|
38
|
-
|
|
39
|
-
### 사전 관리 명령어
|
|
40
|
-
|
|
41
|
-
VS 코드에서 직접 콘텐츠 사전을 관리하세요:
|
|
42
|
-
|
|
43
|
-
- **사전 빌드** – 프로젝트 구조를 기반으로 콘텐츠 파일을 생성합니다.
|
|
44
|
-
- **사전 푸시** – 최신 사전 콘텐츠를 저장소에 업로드합니다.
|
|
45
|
-
- **사전 풀** – 저장소에서 최신 사전 콘텐츠를 로컬 환경으로 동기화합니다.
|
|
34
|
+
- **즉시 탐색** – `useIntlayer` 키를 클릭하면 올바른 콘텐츠 파일로 빠르게 이동합니다.
|
|
46
35
|
- **사전 채우기** – 프로젝트의 콘텐츠로 사전을 채웁니다.
|
|
47
|
-
- **사전 테스트** – 누락되었거나 불완전한 번역을 식별합니다.
|
|
48
|
-
|
|
49
|
-
### 콘텐츠 선언 생성기
|
|
50
|
-
|
|
51
|
-
다양한 형식으로 구조화된 사전 파일을 쉽게 생성할 수 있습니다:
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+

|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
- **Intlayer 명령어에 쉽게 접근** – 콘텐츠 사전을 빌드, 푸시, 풀, 채우기, 테스트를 손쉽게 수행합니다.
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
const MyComponent = () => {
|
|
59
|
-
const { myTranslatedContent } = useIntlayer("my-component");
|
|
41
|
+

|
|
60
42
|
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
TypeScript 형식으로 생성된 파일:
|
|
43
|
+
- **콘텐츠 선언 생성기** – 다양한 형식(`.ts`, `.esm`, `.cjs`, `.json`)으로 사전 콘텐츠 파일을 생성합니다.
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
import { t, type Dictionary } from "intlayer";
|
|
45
|
+

|
|
69
46
|
|
|
70
|
-
|
|
71
|
-
key: "my-component",
|
|
72
|
-
content: {
|
|
73
|
-
myTranslatedContent: t({
|
|
74
|
-
en: "Hello World",
|
|
75
|
-
es: "Hola Mundo",
|
|
76
|
-
fr: "Bonjour le monde",
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
47
|
+
- **사전 테스트** – 누락된 번역이 있는지 사전을 테스트합니다.
|
|
80
48
|
|
|
81
|
-
|
|
82
|
-
```
|
|
49
|
+

|
|
83
50
|
|
|
84
|
-
|
|
51
|
+
- **사전을 최신 상태로 유지** – 프로젝트의 최신 콘텐츠로 사전을 최신 상태로 유지합니다.
|
|
85
52
|
|
|
86
|
-
|
|
87
|
-
- **ES 모듈 (`.esm`)**
|
|
88
|
-
- **CommonJS (`.cjs`)**
|
|
89
|
-
- **JSON (`.json`)**
|
|
90
|
-
|
|
91
|
-
### Intlayer 탭 (활동 표시줄)
|
|
53
|
+

|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **검색(Search)**: 사전과 그 내용을 빠르게 필터링할 수 있는 실시간 검색 바입니다. 입력할 때마다 결과가 즉시 업데이트됩니다.
|
|
96
|
-
- **사전(Dictionaries)**: 환경/프로젝트, 사전 키, 그리고 항목을 기여하는 파일들의 트리 뷰입니다. 다음 작업을 할 수 있습니다:
|
|
97
|
-
- 파일을 클릭하여 편집기에서 엽니다.
|
|
98
|
-
- 툴바를 사용하여 다음 작업을 실행합니다: 빌드(Build), 풀(Pull), 푸시(Push), 채우기(Fill), 새로고침(Refresh), 테스트(Test), 사전 파일 생성(Create Dictionary File).
|
|
99
|
-
- 항목별 작업을 위한 컨텍스트 메뉴를 사용합니다:
|
|
100
|
-
- 사전에서는: 풀(Pull) 또는 푸시(Push)
|
|
101
|
-
- 파일에서는: 사전 채우기(Fill Dictionary)
|
|
102
|
-
- 편집기를 전환할 때, 해당 파일이 사전에 속해 있으면 트리가 일치하는 파일을 표시합니다.
|
|
103
|
-
|
|
104
|
-
## 설치
|
|
105
|
-
|
|
106
|
-
**Intlayer**를 VS Code 마켓플레이스에서 직접 설치할 수 있습니다:
|
|
107
|
-
|
|
108
|
-
1. **VS Code**를 엽니다.
|
|
109
|
-
2. **확장 마켓플레이스**로 이동합니다.
|
|
110
|
-
3. **"Intlayer"**를 검색합니다.
|
|
111
|
-
4. **설치**를 클릭합니다.
|
|
55
|
+
- **Intlayer 탭 (활동 표시줄)** – 전용 사이드 탭에서 도구 모음과 컨텍스트 작업(빌드, 풀, 푸시, 채우기, 새로 고침, 테스트, 파일 생성)과 함께 사전을 탐색하고 검색합니다.
|
|
112
56
|
|
|
113
57
|
## 사용법
|
|
114
58
|
|
|
115
59
|
### 빠른 탐색
|
|
116
60
|
|
|
117
61
|
1. **react-intlayer**를 사용하는 프로젝트를 엽니다.
|
|
118
|
-
2. `useIntlayer()` 호출을
|
|
62
|
+
2. 다음과 같이 `useIntlayer()` 호출을 찾습니다:
|
|
119
63
|
|
|
120
64
|
```tsx
|
|
121
65
|
const content = useIntlayer("app");
|
|
122
66
|
```
|
|
123
67
|
|
|
124
|
-
3. 키(예: `"app"`)에서
|
|
125
|
-
4. VS Code가 자동으로 해당 사전
|
|
126
|
-
|
|
127
|
-
### 콘텐츠 사전 관리
|
|
68
|
+
3. 키(예: `"app"`)에서 **명령-클릭**(`⌘+클릭` macOS) 또는 **Ctrl+클릭**(Windows/Linux)을 합니다.
|
|
69
|
+
4. VS Code가 자동으로 해당 사전 파일을 엽니다. 예: `src/app.content.ts`.
|
|
128
70
|
|
|
129
71
|
### Intlayer 탭 (활동 표시줄)
|
|
130
72
|
|
|
131
|
-
|
|
73
|
+
사이드 탭을 사용하여 사전을 탐색하고 관리하세요:
|
|
132
74
|
|
|
133
75
|
- 활동 표시줄에서 Intlayer 아이콘을 엽니다.
|
|
134
|
-
-
|
|
135
|
-
-
|
|
76
|
+
- **검색**에서 입력하여 사전과 항목을 실시간으로 필터링합니다.
|
|
77
|
+
- **사전**에서 환경, 사전, 파일을 탐색합니다. 툴바를 사용하여 빌드(Build), 풀(Pull), 푸시(Push), 채우기(Fill), 새로고침(Refresh), 테스트(Test), 사전 파일 생성(Create Dictionary File)을 수행할 수 있습니다. 마우스 오른쪽 버튼 클릭으로 컨텍스트 작업(사전에서 풀/푸시, 파일에서 채우기)을 사용할 수 있습니다. 현재 편집 중인 파일은 해당되는 경우 트리에서 자동으로 표시됩니다.
|
|
136
78
|
|
|
137
|
-
|
|
79
|
+
### 명령어 접근
|
|
138
80
|
|
|
139
|
-
|
|
81
|
+
명령어는 **명령 팔레트**에서 접근할 수 있습니다.
|
|
140
82
|
|
|
141
83
|
```sh
|
|
142
84
|
Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
|
|
143
85
|
```
|
|
144
86
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
1. **명령 팔레트(Command Palette)**를 엽니다.
|
|
152
|
-
2. **Push Dictionaries**를 검색합니다.
|
|
153
|
-
3. 푸시할 사전을 선택하고 확인합니다.
|
|
154
|
-
|
|
155
|
-
#### 사전 풀하기
|
|
87
|
+
- **사전 빌드(Build Dictionaries)**
|
|
88
|
+
- **사전 푸시(Push Dictionaries)**
|
|
89
|
+
- **사전 풀(Pull Dictionaries)**
|
|
90
|
+
- **사전 채우기(Fill Dictionaries)**
|
|
91
|
+
- **사전 테스트(Test Dictionaries)**
|
|
92
|
+
- **사전 파일 생성(Create Dictionary File)**
|
|
156
93
|
|
|
157
|
-
|
|
94
|
+
### 환경 변수 로딩
|
|
158
95
|
|
|
159
|
-
|
|
160
|
-
2. **Pull Dictionaries**를 검색합니다.
|
|
161
|
-
3. 가져올 사전을 선택합니다.
|
|
96
|
+
Intlayer는 AI API 키와 Intlayer 클라이언트 ID 및 시크릿을 환경 변수에 저장할 것을 권장합니다.
|
|
162
97
|
|
|
163
|
-
|
|
98
|
+
이 확장 프로그램은 작업 공간에서 환경 변수를 로드하여 올바른 컨텍스트로 Intlayer 명령을 실행할 수 있습니다.
|
|
164
99
|
|
|
165
|
-
|
|
100
|
+
- **로드 순서(우선순위)**: `.env.<env>.local` → `.env.<env>` → `.env.local` → `.env`
|
|
101
|
+
- **비파괴적**: 기존의 `process.env` 값은 덮어쓰지 않습니다.
|
|
102
|
+
- **범위**: 파일은 구성된 기본 디렉터리(기본값은 작업 공간 루트)에서 해석됩니다.
|
|
166
103
|
|
|
167
|
-
|
|
168
|
-
2. **Fill Dictionaries**를 검색합니다.
|
|
169
|
-
3. 사전을 채우기 위해 명령을 실행합니다.
|
|
104
|
+
#### 활성 환경 선택
|
|
170
105
|
|
|
171
|
-
|
|
106
|
+
- **명령 팔레트**: 팔레트를 열고 `Intlayer: Select Environment` 명령을 실행한 후 환경(예: `development`, `staging`, `production`)을 선택합니다. 확장 기능은 위 우선순위 목록에서 첫 번째로 사용 가능한 파일을 로드하려 시도하며, “Loaded env from .env.<env>.local”과 같은 알림을 표시합니다.
|
|
107
|
+
- **설정**: `설정 → 확장 기능 → Intlayer`로 이동하여 다음을 설정합니다:
|
|
108
|
+
- **환경(Environment)**: `.env.<env>*` 파일을 해석하는 데 사용되는 환경 이름입니다.
|
|
109
|
+
- (선택 사항) **Env 파일**: 명시적인 `.env` 파일 경로입니다. 제공되면 추론된 목록보다 우선합니다.
|
|
172
110
|
|
|
173
|
-
|
|
111
|
+
#### 모노레포 및 사용자 지정 디렉토리
|
|
174
112
|
|
|
175
|
-
|
|
176
|
-
2. **Test Dictionaries**를 검색합니다.
|
|
177
|
-
3. 보고된 문제를 검토하고 필요에 따라 수정합니다.
|
|
113
|
+
워크스페이스 루트 외부에 `.env` 파일이 있는 경우, `설정 → 확장 기능 → Intlayer`에서 **기본 디렉터리**를 설정하세요. 로더는 해당 디렉터리를 기준으로 `.env` 파일을 찾습니다.
|
|
178
114
|
|
|
179
115
|
## 문서 이력
|
|
180
116
|
|
|
181
|
-
| 버전 | 날짜 | 변경 사항
|
|
182
|
-
| ------ | ---------- |
|
|
183
|
-
|
|
|
117
|
+
| 버전 | 날짜 | 변경 사항 |
|
|
118
|
+
| ------ | ---------- | ---------------------------------------- |
|
|
119
|
+
| 6.1.5 | 2025-09-30 | 데모 GIF 추가 |
|
|
120
|
+
| 6.1.0 | 2025-09-24 | 환경 선택 섹션 추가 |
|
|
121
|
+
| 6.0.0 | 2025-09-22 | Intlayer 탭 / 채우기 및 테스트 명령 추가 |
|
|
122
|
+
| 5.5.10 | 2025-06-29 | 초기 이력 |
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
|
+
title: Tornar um componente multilíngue (biblioteca i18n) em React e Next.js
|
|
5
|
+
description: Aprenda como declarar e recuperar conteúdo localizado para construir um componente multilíngue em React ou Next.js com Intlayer.
|
|
6
|
+
keywords:
|
|
7
|
+
- i18n
|
|
8
|
+
- componente
|
|
9
|
+
- react
|
|
10
|
+
- multilíngue
|
|
11
|
+
- next.js
|
|
12
|
+
- intlayer
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- component
|
|
16
|
+
- i18n
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
18
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Como tornar um componente multilíngue (i18n) com Intlayer
|
|
22
|
+
|
|
23
|
+
Este guia mostra os passos mínimos para tornar um componente de interface multilíngue em duas configurações comuns:
|
|
24
|
+
|
|
25
|
+
- React (Vite/SPA)
|
|
26
|
+
- Next.js (App Router)
|
|
27
|
+
|
|
28
|
+
Você primeiro declarará seu conteúdo, depois o recuperará no seu componente.
|
|
29
|
+
|
|
30
|
+
## 1) Declare seu conteúdo (compartilhado para React e Next.js)
|
|
31
|
+
|
|
32
|
+
Crie um arquivo de declaração de conteúdo próximo ao seu componente. Isso mantém as traduções próximas de onde são usadas e permite segurança de tipos.
|
|
33
|
+
|
|
34
|
+
```ts fileName="component.content.ts"
|
|
35
|
+
import { t, type Dictionary } from "intlayer";
|
|
36
|
+
|
|
37
|
+
const componentContent = {
|
|
38
|
+
key: "component-example",
|
|
39
|
+
content: {
|
|
40
|
+
title: t({
|
|
41
|
+
en: "Hello",
|
|
42
|
+
fr: "Bonjour",
|
|
43
|
+
es: "Hola",
|
|
44
|
+
}),
|
|
45
|
+
description: t({
|
|
46
|
+
en: "A multilingual React component",
|
|
47
|
+
fr: "Un composant React multilingue",
|
|
48
|
+
es: "Un componente React multilingüe",
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
} satisfies Dictionary;
|
|
52
|
+
|
|
53
|
+
export default componentContent;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
JSON também é suportado se você preferir arquivos de configuração.
|
|
57
|
+
|
|
58
|
+
```json fileName="component.content.json"
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
61
|
+
"key": "component-example",
|
|
62
|
+
"content": {
|
|
63
|
+
"title": {
|
|
64
|
+
"nodeType": "translation",
|
|
65
|
+
"translation": { "en": "Hello", "fr": "Bonjour", "es": "Hola" }
|
|
66
|
+
},
|
|
67
|
+
"description": {
|
|
68
|
+
"nodeType": "translation",
|
|
69
|
+
"translation": {
|
|
70
|
+
"en": "A multilingual React component",
|
|
71
|
+
"fr": "Un composant React multilingue",
|
|
72
|
+
"es": "Un componente React multilingüe"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 2) Recupere seu conteúdo
|
|
80
|
+
|
|
81
|
+
### Caso A — Aplicação React (Vite/SPA)
|
|
82
|
+
|
|
83
|
+
Abordagem padrão: use `useIntlayer` para recuperar pelo key. Isso mantém os componentes enxutos e tipados.
|
|
84
|
+
|
|
85
|
+
```tsx fileName="ComponentExample.tsx"
|
|
86
|
+
import { useIntlayer } from "react-intlayer";
|
|
87
|
+
|
|
88
|
+
export function ComponentExample() {
|
|
89
|
+
const content = useIntlayer("component-example");
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
<h1>{content.title}</h1>
|
|
93
|
+
<p>{content.description}</p>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Renderização do lado servidor ou fora do provider: use `react-intlayer/server` e passe um `locale` explícito quando necessário.
|
|
100
|
+
|
|
101
|
+
```tsx fileName="ServerRenderedExample.tsx"
|
|
102
|
+
import { useIntlayer } from "react-intlayer/server";
|
|
103
|
+
|
|
104
|
+
export function ServerRenderedExample({ locale }: { locale: string }) {
|
|
105
|
+
const content = useIntlayer("component-example", locale);
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<h1>{content.title}</h1>
|
|
109
|
+
<p>{content.description}</p>
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Alternativa: `useDictionary` pode ler um objeto declarado inteiro se você preferir colocar a estrutura no local da chamada.
|
|
116
|
+
|
|
117
|
+
```tsx fileName="ComponentWithDictionary.tsx"
|
|
118
|
+
import { useDictionary } from "react.intlayer";
|
|
119
|
+
import componentContent from "./component.content";
|
|
120
|
+
|
|
121
|
+
export function ComponentWithDictionary() {
|
|
122
|
+
const { title, description } = useDictionary(componentContent);
|
|
123
|
+
return (
|
|
124
|
+
<div>
|
|
125
|
+
<h1>{title}</h1>
|
|
126
|
+
<p>{description}</p>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Caso B — Next.js (App Router)
|
|
133
|
+
|
|
134
|
+
Prefira componentes de servidor para segurança dos dados e desempenho. Use `useIntlayer` de `next-intlayer/server` em arquivos de servidor, e `useIntlayer` de `next-intlayer` em componentes cliente.
|
|
135
|
+
|
|
136
|
+
```tsx fileName="app/[locale]/example/ServerComponent.tsx"
|
|
137
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
138
|
+
|
|
139
|
+
export default function ServerComponent() {
|
|
140
|
+
const content = useIntlayer("component-example");
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
<h1>{content.title}</h1>
|
|
144
|
+
<p>{content.description}</p>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```tsx fileName="app/[locale]/example/ClientComponent.tsx"
|
|
151
|
+
"use client";
|
|
152
|
+
|
|
153
|
+
import { useIntlayer } from "next-intlayer";
|
|
154
|
+
|
|
155
|
+
export function ClientComponent() {
|
|
156
|
+
const content = useIntlayer("component-example");
|
|
157
|
+
return (
|
|
158
|
+
<div>
|
|
159
|
+
<h1>{content.title}</h1>
|
|
160
|
+
<p>{content.description}</p>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Dica: Para metadados de página e SEO, você também pode buscar conteúdo usando `getIntlayer` e gerar URLs multilíngues via `getMultilingualUrls`.
|
|
167
|
+
|
|
168
|
+
## Por que a abordagem de componentes do Intlayer é a melhor
|
|
169
|
+
|
|
170
|
+
- **Colocação**: Declarações de conteúdo ficam próximas aos componentes, reduzindo desvios e melhorando o reuso em sistemas de design.
|
|
171
|
+
- **Segurança de tipos**: Chaves e estruturas são fortemente tipadas; traduções ausentes aparecem em tempo de build, e não em tempo de execução.
|
|
172
|
+
- **Server-first**: Funciona nativamente em componentes de servidor para melhor segurança e desempenho; hooks do cliente permanecem ergonômicos.
|
|
173
|
+
- **Tree-shaking**: Apenas o conteúdo usado pelo componente é incluído no pacote, mantendo os tamanhos pequenos em grandes aplicações.
|
|
174
|
+
- **DX & ferramentas**: Middleware embutido, auxiliares de SEO e traduções opcionais via Editor Visual/IA agilizam o trabalho diário.
|
|
175
|
+
|
|
176
|
+
Veja as comparações e padrões no resumo focado em Next.js: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
177
|
+
|
|
178
|
+
## Guias e referências relacionadas
|
|
179
|
+
|
|
180
|
+
- Configuração React (Vite): https://intlayer.org/doc/environment/vite-and-react
|
|
181
|
+
- React Router v7: https://intlayer.org/doc/environment/vite-and-react/react-router-v7
|
|
182
|
+
- Início TanStack: https://intlayer.org/doc/environment/vite-and-react/tanstack-start
|
|
183
|
+
- Configuração do Next.js: https://intlayer.org/doc/environment/nextjs
|
|
184
|
+
- Por que Intlayer vs. next-intl vs. next-i18next: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
185
|
+
|
|
186
|
+
Estas páginas incluem configuração completa, provedores, roteamento e auxiliares de SEO.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-17
|
|
3
|
-
updatedAt: 2025-09-
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
4
|
title: Extensão Oficial do VS Code
|
|
5
|
-
description: Aprenda a usar a extensão Intlayer no VS Code para
|
|
5
|
+
description: Aprenda a usar a extensão Intlayer no VS Code para melhorar seu fluxo de trabalho de desenvolvimento. Navegue rapidamente entre conteúdos localizados e gerencie seus dicionários de forma eficiente.
|
|
6
6
|
keywords:
|
|
7
7
|
- Extensão VS Code
|
|
8
8
|
- Intlayer
|
|
@@ -21,94 +21,38 @@ slugs:
|
|
|
21
21
|
|
|
22
22
|
## Visão Geral
|
|
23
23
|
|
|
24
|
-
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) é a extensão oficial do Visual Studio Code para **Intlayer**, projetada para melhorar a experiência do desenvolvedor ao trabalhar com conteúdo localizado em seus projetos.
|
|
24
|
+
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) é a extensão oficial do Visual Studio Code para o **Intlayer**, projetada para melhorar a experiência do desenvolvedor ao trabalhar com conteúdo localizado em seus projetos.
|
|
25
25
|
|
|
26
|
-

|
|
26
|
+

|
|
27
27
|
|
|
28
28
|
Link da extensão: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
|
|
29
29
|
|
|
30
30
|
## Funcionalidades
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+

|
|
33
33
|
|
|
34
|
-
**
|
|
35
|
-
**
|
|
36
|
-
**Suporte Multilíngue** – Suporta conteúdo localizado em diferentes idiomas.
|
|
37
|
-
**Integração com VS Code** – Integra-se suavemente com a navegação e a paleta de comandos do VS Code.
|
|
34
|
+
- **Navegação Instantânea** – Vá rapidamente para o arquivo de conteúdo correto ao clicar em uma chave `useIntlayer`.
|
|
35
|
+
- **Preencher Dicionários** – Preencha dicionários com conteúdo do seu projeto.
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+

|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
- **Acesso fácil aos comandos do Intlayer** – Construir, enviar, puxar, preencher e testar dicionários de conteúdo com facilidade.
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
- **Enviar Dicionários** – Faça upload do conteúdo mais recente do dicionário para o seu repositório.
|
|
45
|
-
- **Puxar Dicionários** – Sincronize o conteúdo mais recente do dicionário do seu repositório para o seu ambiente local.
|
|
46
|
-
- **Preencher Dicionários** – Popule os dicionários com conteúdo do seu projeto.
|
|
47
|
-
- **Testar Dicionários** – Identifique traduções faltantes ou incompletas.
|
|
41
|
+

|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
- **Gerador de Declaração de Conteúdo** – Criar arquivos de conteúdo de dicionário em vários formatos (`.ts`, `.esm`, `.cjs`, `.json`).
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+

|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
- **Testar Dicionários** – Testar dicionários para traduções ausentes.
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+

|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
const MyComponent = () => {
|
|
59
|
-
const { myTranslatedContent } = useIntlayer("my-component");
|
|
51
|
+
- **Mantenha seus dicionários atualizados** – Mantenha seus dicionários atualizados com o conteúdo mais recente do seu projeto.
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Arquivo gerado no formato TypeScript:
|
|
66
|
-
|
|
67
|
-
```tsx fileName="src/components/MyComponent/index.content.ts"
|
|
68
|
-
import { t, type Dictionary } from "intlayer";
|
|
69
|
-
|
|
70
|
-
const componentContent = {
|
|
71
|
-
key: "my-component",
|
|
72
|
-
content: {
|
|
73
|
-
myTranslatedContent: t({
|
|
74
|
-
en: "Hello World",
|
|
75
|
-
es: "Hola Mundo",
|
|
76
|
-
fr: "Bonjour le monde",
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default componentContent;
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Formatos disponíveis:
|
|
85
|
-
|
|
86
|
-
- **TypeScript (`.ts`)**
|
|
87
|
-
- **ES Module (`.esm`)**
|
|
88
|
-
- **CommonJS (`.cjs`)**
|
|
89
|
-
- **JSON (`.json`)**
|
|
90
|
-
|
|
91
|
-
### Aba Intlayer (Barra de Atividades)
|
|
53
|
+

|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **Pesquisar**: Uma barra de pesquisa ao vivo para filtrar rapidamente os dicionários e seu conteúdo. Digitar atualiza os resultados instantaneamente.
|
|
96
|
-
- **Dicionários**: Uma visualização em árvore dos seus ambientes/projetos, chaves dos dicionários e os arquivos que contribuem com entradas. Você pode:
|
|
97
|
-
- Clicar em um arquivo para abri-lo no editor.
|
|
98
|
-
- Usar a barra de ferramentas para executar ações: Build, Pull, Push, Fill, Refresh, Test e Create Dictionary File.
|
|
99
|
-
- Usar o menu de contexto para ações específicas do item:
|
|
100
|
-
- Em um dicionário: Pull ou Push
|
|
101
|
-
- Em um arquivo: Fill Dictionary
|
|
102
|
-
- Quando você alternar de editor, a árvore revelará o arquivo correspondente se ele pertencer a um dicionário.
|
|
103
|
-
|
|
104
|
-
## Instalação
|
|
105
|
-
|
|
106
|
-
Você pode instalar o **Intlayer** diretamente no Marketplace do VS Code:
|
|
107
|
-
|
|
108
|
-
1. Abra o **VS Code**.
|
|
109
|
-
2. Vá para o **Marketplace de Extensões**.
|
|
110
|
-
3. Pesquise por **"Intlayer"**.
|
|
111
|
-
4. Clique em **Instalar**.
|
|
55
|
+
- **Aba Intlayer (Barra de Atividades)** – Navegue e pesquise dicionários em uma aba lateral dedicada com barra de ferramentas e ações de contexto (Construir, Puxar, Enviar, Preencher, Atualizar, Testar, Criar Arquivo).
|
|
112
56
|
|
|
113
57
|
## Uso
|
|
114
58
|
|
|
@@ -121,63 +65,58 @@ Você pode instalar o **Intlayer** diretamente no Marketplace do VS Code:
|
|
|
121
65
|
const content = useIntlayer("app");
|
|
122
66
|
```
|
|
123
67
|
|
|
124
|
-
3. **
|
|
68
|
+
3. **Clique com comando** (`⌘+Clique` no macOS) ou **Ctrl+Clique** (no Windows/Linux) na chave (por exemplo, `"app"`).
|
|
125
69
|
4. O VS Code abrirá automaticamente o arquivo de dicionário correspondente, por exemplo, `src/app.content.ts`.
|
|
126
70
|
|
|
127
|
-
### Gerenciando Dicionários de Conteúdo
|
|
128
|
-
|
|
129
71
|
### Aba Intlayer (Barra de Atividades)
|
|
130
72
|
|
|
131
|
-
Use a aba lateral para navegar e gerenciar
|
|
73
|
+
Use a aba lateral para navegar e gerenciar dicionários:
|
|
132
74
|
|
|
133
75
|
- Abra o ícone do Intlayer na Barra de Atividades.
|
|
134
76
|
- Em **Pesquisar**, digite para filtrar dicionários e entradas em tempo real.
|
|
135
77
|
- Em **Dicionários**, navegue por ambientes, dicionários e arquivos. Use a barra de ferramentas para Construir, Puxar, Enviar, Preencher, Atualizar, Testar e Criar Arquivo de Dicionário. Clique com o botão direito para ações de contexto (Puxar/Enviar em dicionários, Preencher em arquivos). O arquivo atual do editor é revelado automaticamente na árvore quando aplicável.
|
|
136
78
|
|
|
137
|
-
|
|
79
|
+
### Acessando os comandos
|
|
138
80
|
|
|
139
|
-
|
|
81
|
+
Você pode acessar os comandos a partir da **Paleta de Comandos**.
|
|
140
82
|
|
|
141
83
|
```sh
|
|
142
84
|
Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
|
|
143
85
|
```
|
|
144
86
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
1. Abra a **Paleta de Comandos**.
|
|
152
|
-
2. Pesquise por **Enviar Dicionários**.
|
|
153
|
-
3. Selecione os dicionários para enviar e confirme.
|
|
154
|
-
|
|
155
|
-
#### Puxando Dicionários
|
|
87
|
+
- **Construir Dicionários**
|
|
88
|
+
- **Enviar Dicionários**
|
|
89
|
+
- **Puxar Dicionários**
|
|
90
|
+
- **Preencher Dicionários**
|
|
91
|
+
- **Testar Dicionários**
|
|
92
|
+
- **Criar Arquivo de Dicionário**
|
|
156
93
|
|
|
157
|
-
|
|
94
|
+
### Carregando Variáveis de Ambiente
|
|
158
95
|
|
|
159
|
-
|
|
160
|
-
2. Procure por **Puxar Dicionários**.
|
|
161
|
-
3. Escolha os dicionários para puxar.
|
|
96
|
+
O Intlayer recomenda armazenar suas chaves de API de IA, assim como o ID e o segredo do cliente Intlayer, em variáveis de ambiente.
|
|
162
97
|
|
|
163
|
-
|
|
98
|
+
A extensão pode carregar variáveis de ambiente do seu espaço de trabalho para executar comandos do Intlayer com o contexto correto.
|
|
164
99
|
|
|
165
|
-
|
|
100
|
+
- **Ordem de carregamento (por prioridade)**: `.env.<env>.local` → `.env.<env>` → `.env.local` → `.env`
|
|
101
|
+
- **Não destrutivo**: valores existentes em `process.env` não são sobrescritos.
|
|
102
|
+
- **Escopo**: os arquivos são resolvidos a partir do diretório base configurado (padrão é a raiz do espaço de trabalho).
|
|
166
103
|
|
|
167
|
-
|
|
168
|
-
2. Procure por **Preencher Dicionários**.
|
|
169
|
-
3. Execute o comando para popular os dicionários.
|
|
104
|
+
#### Selecionando o ambiente ativo
|
|
170
105
|
|
|
171
|
-
|
|
106
|
+
- **Paleta de Comandos**: abra a paleta e execute `Intlayer: Select Environment`, depois escolha o ambiente (por exemplo, `development`, `staging`, `production`). A extensão tentará carregar o primeiro arquivo disponível na lista de prioridade acima e mostrará uma notificação como “Loaded env from .env.<env>.local”.
|
|
107
|
+
- **Configurações**: vá para `Settings → Extensions → Intlayer` e defina:
|
|
108
|
+
- **Environment**: o nome do ambiente usado para resolver arquivos `.env.<env>*`.
|
|
109
|
+
- (Opcional) **Env File**: um caminho explícito para um arquivo `.env`. Quando fornecido, ele tem precedência sobre a lista inferida.
|
|
172
110
|
|
|
173
|
-
|
|
111
|
+
#### Monorepos e diretórios personalizados
|
|
174
112
|
|
|
175
|
-
|
|
176
|
-
2. Procure por **Testar Dicionários**.
|
|
177
|
-
3. Revise os problemas relatados e corrija conforme necessário.
|
|
113
|
+
Se os seus arquivos `.env` estiverem fora da raiz do espaço de trabalho, defina o **Diretório Base** em `Configurações → Extensões → Intlayer`. O carregador irá procurar arquivos `.env` relativos a esse diretório.
|
|
178
114
|
|
|
179
115
|
## Histórico do Documento
|
|
180
116
|
|
|
181
|
-
| Versão | Data | Alterações
|
|
182
|
-
| ------ | ---------- |
|
|
183
|
-
|
|
|
117
|
+
| Versão | Data | Alterações |
|
|
118
|
+
| ------ | ---------- | ------------------------------------------ |
|
|
119
|
+
| 6.1.5 | 2025-09-30 | Adicionado gif de demonstração |
|
|
120
|
+
| 6.1.0 | 2025-09-24 | Adicionada seção de seleção de ambiente |
|
|
121
|
+
| 6.0.0 | 2025-09-22 | Aba Intlayer / Comandos Preencher & Testar |
|
|
122
|
+
| 5.5.10 | 2025-06-29 | Histórico inicial |
|