@intlayer/docs 5.7.6 → 5.7.7

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.
Files changed (73) hide show
  1. package/dist/cjs/generated/docs.entry.cjs +44 -238
  2. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  3. package/dist/esm/generated/docs.entry.mjs +44 -238
  4. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  5. package/dist/types/generated/docs.entry.d.ts +1 -2
  6. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  7. package/docs/ar/intlayer_with_tanstack.md +457 -0
  8. package/docs/ar/packages/next-intlayer/index.md +0 -1
  9. package/docs/ar/packages/react-intlayer/index.md +0 -1
  10. package/docs/de/intlayer_with_tanstack.md +458 -0
  11. package/docs/de/packages/next-intlayer/index.md +0 -1
  12. package/docs/de/packages/react-intlayer/index.md +0 -1
  13. package/docs/en/intlayer_with_tanstack.md +452 -0
  14. package/docs/en/packages/next-intlayer/index.md +0 -1
  15. package/docs/en/packages/react-intlayer/index.md +0 -1
  16. package/docs/en-GB/intlayer_with_tanstack.md +457 -0
  17. package/docs/en-GB/packages/next-intlayer/index.md +0 -1
  18. package/docs/en-GB/packages/react-intlayer/index.md +0 -1
  19. package/docs/es/intlayer_with_tanstack.md +435 -0
  20. package/docs/es/packages/next-intlayer/index.md +0 -1
  21. package/docs/es/packages/react-intlayer/index.md +0 -1
  22. package/docs/fr/intlayer_with_tanstack.md +435 -0
  23. package/docs/fr/packages/next-intlayer/index.md +0 -1
  24. package/docs/fr/packages/react-intlayer/index.md +0 -1
  25. package/docs/hi/intlayer_with_tanstack.md +438 -0
  26. package/docs/hi/packages/next-intlayer/index.md +0 -1
  27. package/docs/hi/packages/react-intlayer/index.md +0 -1
  28. package/docs/it/intlayer_with_tanstack.md +457 -0
  29. package/docs/it/packages/next-intlayer/index.md +0 -1
  30. package/docs/it/packages/react-intlayer/index.md +0 -1
  31. package/docs/ja/intlayer_with_tanstack.md +457 -0
  32. package/docs/ja/packages/next-intlayer/index.md +0 -1
  33. package/docs/ja/packages/react-intlayer/index.md +0 -1
  34. package/docs/ko/intlayer_with_tanstack.md +457 -0
  35. package/docs/ko/packages/next-intlayer/index.md +0 -1
  36. package/docs/ko/packages/react-intlayer/index.md +0 -1
  37. package/docs/pt/intlayer_with_tanstack.md +457 -0
  38. package/docs/pt/packages/next-intlayer/index.md +0 -1
  39. package/docs/pt/packages/react-intlayer/index.md +0 -1
  40. package/docs/ru/intlayer_with_tanstack.md +458 -0
  41. package/docs/ru/packages/next-intlayer/index.md +0 -1
  42. package/docs/ru/packages/react-intlayer/index.md +0 -1
  43. package/docs/zh/intlayer_with_tanstack.md +435 -0
  44. package/docs/zh/packages/next-intlayer/index.md +0 -1
  45. package/docs/zh/packages/react-intlayer/index.md +0 -1
  46. package/package.json +9 -9
  47. package/src/generated/docs.entry.ts +44 -238
  48. package/docs/ar/packages/next-intlayer/useIntlayerAsync.md +0 -237
  49. package/docs/ar/packages/react-intlayer/useIntlayerAsync.md +0 -252
  50. package/docs/de/packages/next-intlayer/useIntlayerAsync.md +0 -262
  51. package/docs/de/packages/react-intlayer/useIntlayerAsync.md +0 -256
  52. package/docs/en/packages/next-intlayer/useIntlayerAsync.md +0 -239
  53. package/docs/en/packages/react-intlayer/useIntlayerAsync.md +0 -254
  54. package/docs/en-GB/packages/next-intlayer/useIntlayerAsync.md +0 -237
  55. package/docs/en-GB/packages/react-intlayer/useIntlayerAsync.md +0 -257
  56. package/docs/es/packages/next-intlayer/useIntlayerAsync.md +0 -240
  57. package/docs/es/packages/react-intlayer/useIntlayerAsync.md +0 -276
  58. package/docs/fr/packages/next-intlayer/useIntlayerAsync.md +0 -238
  59. package/docs/fr/packages/react-intlayer/useIntlayerAsync.md +0 -252
  60. package/docs/hi/packages/next-intlayer/useIntlayerAsync.md +0 -237
  61. package/docs/hi/packages/react-intlayer/useIntlayerAsync.md +0 -252
  62. package/docs/it/packages/next-intlayer/useIntlayerAsync.md +0 -237
  63. package/docs/it/packages/react-intlayer/useIntlayerAsync.md +0 -252
  64. package/docs/ja/packages/next-intlayer/useIntlayerAsync.md +0 -237
  65. package/docs/ja/packages/react-intlayer/useIntlayerAsync.md +0 -268
  66. package/docs/ko/packages/next-intlayer/useIntlayerAsync.md +0 -260
  67. package/docs/ko/packages/react-intlayer/useIntlayerAsync.md +0 -271
  68. package/docs/pt/packages/next-intlayer/useIntlayerAsync.md +0 -238
  69. package/docs/pt/packages/react-intlayer/useIntlayerAsync.md +0 -252
  70. package/docs/ru/packages/next-intlayer/useIntlayerAsync.md +0 -237
  71. package/docs/ru/packages/react-intlayer/useIntlayerAsync.md +0 -252
  72. package/docs/zh/packages/next-intlayer/useIntlayerAsync.md +0 -239
  73. package/docs/zh/packages/react-intlayer/useIntlayerAsync.md +0 -257
@@ -1,271 +0,0 @@
1
- ---
2
- createdAt: 2024-08-11
3
- updatedAt: 2025-06-29
4
- title: useIntlayerAsync 훅 문서 | react-intlayer
5
- description: react-intlayer 패키지의 useIntlayerAsync 훅 사용법을 확인하세요
6
- keywords:
7
- - useIntlayerAsync
8
- - dictionary
9
- - key
10
- - Intlayer
11
- - 국제화
12
- - 문서
13
- - Next.js
14
- - JavaScript
15
- - React
16
- slugs:
17
- - doc
18
- - packages
19
- - react-intlayer
20
- - useIntlayerAsync
21
- ---
22
-
23
- # React 통합: `useIntlayerAsync` 훅 문서
24
-
25
- `useIntlayerAsync` 훅은 `useIntlayer`의 기능을 확장하여, 미리 렌더링된 사전을 반환하는 것뿐만 아니라 업데이트를 비동기적으로 가져와 초기 렌더링 후에 현지화된 콘텐츠를 자주 업데이트하는 애플리케이션에 이상적입니다.
26
-
27
- ## 개요
28
-
29
- - **비동기 사전 로딩:**
30
- 초기 마운트 시, `useIntlayerAsync`는 먼저 미리 가져오거나 정적으로 번들된 로케일 사전을 반환합니다(`useIntlayer`와 동일). 그 후 새로 사용 가능한 원격 사전을 비동기적으로 가져와 병합합니다.
31
- - **진행 상태 관리:**
32
- 이 훅은 원격 사전을 가져오는 동안을 나타내는 `isLoading` 상태도 제공합니다. 이를 통해 개발자는 로딩 인디케이터나 스켈레톤 상태를 표시하여 사용자 경험을 부드럽게 만들 수 있습니다.
33
-
34
- ## 환경 설정
35
-
36
- Intlayer는 비개발자도 애플리케이션 콘텐츠를 원활하게 관리하고 업데이트할 수 있도록 하는 헤드리스 콘텐츠 소스 관리(CSM) 시스템을 제공합니다. Intlayer의 직관적인 대시보드를 사용하면 팀이 코드 수정 없이도 현지화된 텍스트, 이미지 및 기타 리소스를 편집할 수 있습니다. 이는 콘텐츠 관리 프로세스를 간소화하고 협업을 촉진하며 업데이트를 빠르고 쉽게 수행할 수 있도록 보장합니다.
37
-
38
- Intlayer를 시작하려면:
39
-
40
- 1. [https://intlayer.org/dashboard](https://intlayer.org/dashboard)에서 **등록하고 액세스 토큰을 받으세요**.
41
- 2. **구성 파일에 자격 증명을 추가하세요:**
42
- React 프로젝트에서 자격 증명을 사용하여 Intlayer 클라이언트를 구성합니다:
43
-
44
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
45
- import type { IntlayerConfig } from "intlayer";
46
-
47
- export default {
48
- // ...
49
- editor: {
50
- clientId: process.env.INTLAYER_CLIENT_ID,
51
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
52
- },
53
- } satisfies IntlayerConfig;
54
- ```
55
-
56
- ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
57
- import { type IntlayerConfig } from "intlayer";
58
-
59
- /** @type {import('intlayer').IntlayerConfig} */
60
- const config = {
61
- // ...
62
- editor: {
63
- clientId: process.env.INTLAYER_CLIENT_ID,
64
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
65
- },
66
- };
67
-
68
- export default config;
69
- ```
70
-
71
- ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
72
- /** @type {import('intlayer').IntlayerConfig} */
73
- const config = {
74
- // ...
75
- editor: {
76
- clientId: process.env.INTLAYER_CLIENT_ID,
77
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
78
- },
79
- };
80
-
81
- module.exports = config;
82
- ```
83
-
84
- 3. **Intlayer에 새 로케일 사전 푸시하기:**
85
-
86
- ```bash
87
- npx intlayer dictionary push -d my-first-dictionary-key
88
- ```
89
-
90
- 이 명령은 초기 콘텐츠 사전을 업로드하여 Intlayer 플랫폼을 통해 비동기적으로 가져오고 편집할 수 있도록 합니다.
91
-
92
- ## React에서 `useIntlayerAsync` 가져오기
93
-
94
- React 컴포넌트에서 `useIntlayerAsync`를 다음과 같이 가져옵니다:
95
-
96
- ```ts codeFormat="typescript"
97
- import { useIntlayerAsync } from "react-intlayer";
98
- ```
99
-
100
- ```js codeFormat="esm"
101
- import { useIntlayerAsync } from "react-intlayer";
102
- ```
103
-
104
- ```js codeFormat="commonjs"
105
- const { useIntlayerAsync } = require("react-intlayer");
106
- ```
107
-
108
- React 컴포넌트에서 `useIntlayerAsync`를 가져옵니다:
109
-
110
- ```ts codeFormat="typescript"
111
- import { useIntlayerAsync } from "react-intlayer";
112
- ```
113
-
114
- ```js codeFormat="esm"
115
- import { useIntlayerAsync } from "react-intlayer";
116
- ```
117
-
118
- ```js codeFormat="commonjs"
119
- const { useIntlayerAsync } = require("react-intlayer");
120
- ```
121
-
122
- ## 매개변수
123
-
124
- 1. **`key`**:
125
- **유형**: `DictionaryKeys`
126
- 지역화된 콘텐츠 블록을 식별하는 데 사용되는 사전 키입니다. 이 키는 콘텐츠 선언 파일에 정의되어 있어야 합니다.
127
-
128
- 2. **`locale`** (선택 사항):
129
- **유형**: `Locales`
130
- 대상이 되는 특정 로케일입니다. 생략할 경우, 훅은 현재 Intlayer 컨텍스트의 로케일을 사용합니다.
131
-
132
- 3. **`isRenderEditor`** (선택 사항, 기본값은 `true`):
133
- **유형**: `boolean`
134
- 콘텐츠가 Intlayer 편집기 오버레이와 함께 렌더링될 준비가 되었는지 여부를 결정합니다. `false`로 설정하면 반환된 사전 데이터에서 편집기 관련 기능이 제외됩니다.
135
-
136
- ## 반환 값
137
-
138
- 훅은 `key`와 `locale`을 키로 하는 지역화된 콘텐츠가 포함된 사전 객체를 반환합니다. 또한 원격 사전이 현재 로드 중인지 여부를 나타내는 `isLoading` 불리언도 포함합니다.
139
-
140
- ## React 컴포넌트에서의 사용 예시
141
-
142
- ```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
143
- import { useEffect, type FC } from "react";
144
- import { useIntlayerAsync } from "react-intlayer";
145
-
146
- export const ComponentExample: FC = () => {
147
- const { title, description, isLoading } = useIntlayerAsync("async-component");
148
-
149
- useEffect(() => {
150
- if (isLoading) {
151
- console.log("콘텐츠가 로드 중입니다...");
152
- }
153
- }, [isLoading]);
154
-
155
- return (
156
- <div>
157
- {isLoading ? (
158
- <div>
159
- <h1>로딩 중…</h1>
160
- <p>콘텐츠가 업데이트되는 동안 기다려 주세요.</p>
161
- </div>
162
- ) : (
163
- <div>
164
- <h1>{title.value}</h1>
165
- <p>{description.value}</p>
166
- </div>
167
- )}
168
- </div>
169
- );
170
- };
171
- ```
172
-
173
- ```jsx fileName="src/components/ComponentExample.mjx" codeFormat="esm"
174
- import { useEffect } from "react";
175
- import { useIntlayerAsync } from "react-intlayer";
176
-
177
- const ComponentExample = () => {
178
- const { title, description, isLoading } = useIntlayerAsync("async-component");
179
-
180
- useEffect(() => {
181
- if (isLoading) {
182
- console.log("콘텐츠가 로딩 중입니다...");
183
- }
184
- }, [isLoading]);
185
-
186
- return (
187
- <div>
188
- {isLoading ? (
189
- <div>
190
- <h1>로딩 중…</h1>
191
- <p>콘텐츠가 업데이트되는 동안 기다려 주세요.</p>
192
- </div>
193
- ) : (
194
- <div>
195
- <h1>{title.value}</h1>
196
- <p>{description.value}</p>
197
- </div>
198
- )}
199
- </div>
200
- );
201
- };
202
- </div>
203
- )}
204
- </div>
205
- );
206
- };
207
- ```
208
-
209
- ```jsx fileName="src/components/ComponentExample.csx" codeFormat="commonjs"
210
- const { useEffect } = require("react");
211
- const { useIntlayerAsync } = require("react-intlayer");
212
-
213
- const ComponentExample = () => {
214
- const { title, description, isLoading } = useIntlayerAsync("async-component");
215
-
216
- useEffect(() => {
217
- if (isLoading) {
218
- console.log("콘텐츠를 불러오는 중...");
219
- }
220
- }, [isLoading]);
221
-
222
- return (
223
- <div>
224
- {isLoading ? (
225
- <div>
226
- <h1>로딩 중…</h1>
227
- <p>콘텐츠가 업데이트되는 동안 기다려 주세요.</p>
228
- </div>
229
- ) : (
230
- <div>
231
- <h1>{title.value}</h1>
232
- <p>{description.value}</p>
233
- </div>
234
- )}
235
- </div>
236
- );
237
- };
238
- ```
239
-
240
- **핵심 사항:**
241
-
242
- - 초기 렌더링 시, `title`과 `description`은 미리 가져오거나 정적으로 포함된 로케일 사전에서 가져옵니다.
243
- - `isLoading`이 `true`인 동안, 백그라운드 요청이 업데이트된 사전을 가져옵니다.
244
- - 요청이 완료되면 `title`과 `description`이 최신 콘텐츠로 업데이트되고, `isLoading`은 `false`로 돌아갑니다.
245
-
246
- ## 속성 현지화 처리
247
-
248
- 다양한 HTML 속성(예: `alt`, `title`, `aria-label`)에 대해 현지화된 속성 값을 가져올 수도 있습니다:
249
-
250
- ```jsx
251
- <img src={title.image.src.value} alt={title.image.alt.value} />
252
- ```
253
-
254
- ## 사전 파일
255
-
256
- 모든 콘텐츠 키는 타입 안전성과 런타임 오류 방지를 위해 콘텐츠 선언 파일에 정의되어야 합니다. 이 파일들은 TypeScript 검증을 가능하게 하여 항상 존재하는 키와 로케일을 참조하도록 보장합니다.
257
-
258
- 콘텐츠 선언 파일 설정에 대한 지침은 [여기](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/dictionary/get_started.md)에서 확인할 수 있습니다.
259
-
260
- ## 추가 정보
261
-
262
- - **Intlayer 비주얼 에디터:**
263
- UI에서 직접 콘텐츠를 관리하고 편집할 수 있도록 Intlayer 비주얼 에디터와 통합하세요. 자세한 내용은 [여기](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/intlayer_visual_editor.md)에서 확인할 수 있습니다.
264
-
265
- ---
266
-
267
- **요약하자면**, `useIntlayerAsync`는 사전 렌더링되거나 미리 가져온 사전과 비동기 사전 업데이트를 병합하여 사용자 경험을 향상시키고 콘텐츠 신선도를 유지하도록 설계된 강력한 React 훅입니다. `isLoading`과 TypeScript 기반 콘텐츠 선언을 활용하여 동적이고 현지화된 콘텐츠를 React 애플리케이션에 원활하게 통합할 수 있습니다.
268
-
269
- ## 문서 이력
270
-
271
- - 5.5.10 - 2025-06-29: 초기 이력
@@ -1,238 +0,0 @@
1
- ---
2
- createdAt: 2024-08-11
3
- updatedAt: 2025-06-29
4
- title: Documentação do Hook useIntlayerAsync | next-intlayer
5
- description: Veja como usar o hook useIntlayerAsync para o pacote next-intlayer
6
- keywords:
7
- - useIntlayerAsync
8
- - dicionário
9
- - chave
10
- - Intlayer
11
- - Internacionalização
12
- - Documentação
13
- - Next.js
14
- - JavaScript
15
- - React
16
- slugs:
17
- - doc
18
- - packages
19
- - next-intlayer
20
- - useIntlayerAsync
21
- ---
22
-
23
- # Integração com Next.js: Documentação do Hook `useIntlayerAsync`
24
-
25
- O hook `useIntlayerAsync` estende a funcionalidade do `useIntlayer` ao não apenas retornar dicionários pré-renderizados, mas também buscar atualizações de forma assíncrona, tornando-o ideal para aplicações que atualizam frequentemente seu conteúdo localizado após a renderização inicial.
26
-
27
- ## Visão Geral
28
-
29
- - **Carregamento Assíncrono de Dicionários:**
30
- No lado do cliente, o `useIntlayerAsync` primeiro retorna o dicionário de localidade pré-renderizado (assim como o `useIntlayer`) e depois busca e mescla de forma assíncrona quaisquer dicionários remotos recém-disponíveis.
31
- - **Gerenciamento do Estado de Progresso:**
32
- O hook também fornece um estado `isLoading`, indicando quando um dicionário remoto está sendo buscado. Isso permite que os desenvolvedores exibam indicadores de carregamento ou estados de esqueleto para uma experiência de usuário mais suave.
33
-
34
- ## Configuração do Ambiente
35
-
36
- Intlayer fornece um sistema headless de Gerenciamento de Fonte de Conteúdo (CSM) que capacita não desenvolvedores a gerenciar e atualizar o conteúdo da aplicação de forma fluida. Usando o painel intuitivo do Intlayer, sua equipe pode editar textos localizados, imagens e outros recursos sem modificar diretamente o código. Isso simplifica o processo de gerenciamento de conteúdo, promove a colaboração e garante que as atualizações possam ser feitas rápida e facilmente.
37
-
38
- Para começar com o Intlayer, você precisará primeiro se registrar e obter um token de acesso no [painel](https://intlayer.org/dashboard). Depois de obter suas credenciais, adicione-as ao seu arquivo de configuração conforme mostrado abaixo:
39
-
40
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
41
- import type { IntlayerConfig } from "intlayer";
42
-
43
- export default {
44
- // ...
45
- editor: {
46
- clientId: process.env.INTLAYER_CLIENT_ID,
47
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
48
- },
49
- } satisfies IntlayerConfig;
50
- ```
51
-
52
- ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
53
- import { type IntlayerConfig } from "intlayer";
54
-
55
- /** @type {import('intlayer').IntlayerConfig} */
56
- const config = {
57
- // ...
58
- editor: {
59
- clientId: process.env.INTLAYER_CLIENT_ID,
60
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
61
- },
62
- };
63
-
64
- export default config;
65
- ```
66
-
67
- ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
68
- /** @type {import('intlayer').IntlayerConfig} */
69
- const config = {
70
- // ...
71
- editor: {
72
- clientId: process.env.INTLAYER_CLIENT_ID,
73
- clientSecret: process.env.INTLAYER_CLIENT_SECRET,
74
- },
75
- };
76
-
77
- module.exports = config;
78
- ```
79
-
80
- Após configurar suas credenciais, você pode enviar um novo dicionário de localidade para o Intlayer executando:
81
-
82
- ```bash
83
- npx intlayer dictionary push -d my-first-dictionary-key
84
- ```
85
-
86
- Este comando faz o upload dos seus dicionários de conteúdo iniciais, tornando-os disponíveis para busca e edição assíncronas através da plataforma Intlayer.
87
-
88
- ## Importando `useIntlayerAsync` no Next.js
89
-
90
- Como `useIntlayerAsync` é destinado para componentes **do lado do cliente**, você irá importá-lo do mesmo ponto de entrada do cliente que `useIntlayer`:
91
-
92
- ```tsx codeFormat="typescript"
93
- "use client";
94
-
95
- import { useIntlayerAsync } from "next-intlayer";
96
- ```
97
-
98
- ```javascript codeFormat="esm"
99
- "use client";
100
-
101
- import { useIntlayerAsync } from "next-intlayer";
102
- ```
103
-
104
- ```javascript codeFormat="commonjs"
105
- "use client";
106
-
107
- const { useIntlayerAsync } = require("next-intlayer");
108
- ```
109
-
110
- Certifique-se de que o arquivo de importação esteja anotado com `"use client"` no topo, caso você esteja usando o Next.js App Router com componentes de servidor e cliente separados.
111
-
112
- ## Parâmetros
113
-
114
- 1. **`key`**:
115
- **Tipo**: `DictionaryKeys`
116
- A chave do dicionário usada para identificar o bloco de conteúdo localizado. Esta chave deve ser definida nos seus arquivos de declaração de conteúdo.
117
-
118
- 2. **`locale`** (opcional):
119
- **Tipo**: `Locales`
120
- A localidade específica que você deseja direcionar. Se omitida, o hook usa a localidade do contexto do cliente.
121
-
122
- 3. **`isRenderEditor`** (opcional, padrão `true`):
123
- **Tipo**: `boolean`
124
- Determina se o conteúdo deve estar pronto para renderização com a sobreposição do editor Intlayer. Se definido como `false`, os dados do dicionário retornados excluirão recursos específicos do editor.
125
-
126
- ## Valor de Retorno
127
-
128
- O hook retorna um objeto dicionário contendo o conteúdo localizado identificado por `key` e `locale`. Ele também inclui um booleano `isLoading` que indica se um dicionário remoto está sendo buscado no momento.
129
-
130
- ## Exemplo de Uso no Next.js
131
-
132
- ### Exemplo de Componente do Lado do Cliente
133
-
134
- ```tsx fileName="src/components/AsyncClientComponentExample.tsx" codeFormat="typescript"
135
- "use client";
136
-
137
- import { useEffect, type FC } from "react";
138
- import { useIntlayerAsync } from "next-intlayer";
139
-
140
- export const AsyncClientComponentExample: FC = () => {
141
- const { title, description, isLoading } = useIntlayerAsync("async-component");
142
-
143
- useEffect(() => {
144
- if (isLoading) {
145
- console.log("Conteúdo está carregando...");
146
- }
147
- }, [isLoading]);
148
-
149
- return (
150
- <div>
151
- <h1>{title.value}</h1>
152
- <p>{description.value}</p>
153
- </div>
154
- );
155
- };
156
- ```
157
-
158
- ```jsx fileName="src/components/AsyncClientComponentExample.mjx" codeFormat="esm"
159
- "use client";
160
-
161
- import { useEffect } from "react";
162
- import { useIntlayerAsync } from "next-intlayer";
163
-
164
- const AsyncClientComponentExample = () => {
165
- const { title, description, isLoading } = useIntlayerAsync("async-component");
166
-
167
- useEffect(() => {
168
- if (isLoading) {
169
- console.log("Conteúdo está carregando...");
170
- }
171
- }, [isLoading]);
172
-
173
- return (
174
- <div>
175
- <h1>{title.value}</h1>
176
- <p>{description.value}</p>
177
- </div>
178
- );
179
- };
180
- ```
181
-
182
- ```jsx fileName="src/components/AsyncClientComponentExample.csx" codeFormat="commonjs"
183
- "use client";
184
-
185
- const { useEffect } = require("react");
186
- const { useIntlayerAsync } = require("next-intlayer");
187
-
188
- const AsyncClientComponentExample = () => {
189
- const { title, description, isLoading } = useIntlayerAsync("async-component");
190
-
191
- useEffect(() => {
192
- if (isLoading) {
193
- console.log("Conteúdo está carregando...");
194
- }
195
- }, [isLoading]);
196
-
197
- return (
198
- <div>
199
- <h1>{title.value}</h1>
200
- <p>{description.value}</p>
201
- </div>
202
- );
203
- };
204
- ```
205
-
206
- **Pontos-chave:**
207
-
208
- - Na renderização inicial, `title` e `description` vêm do dicionário de localidade pré-renderizado.
209
-
210
- - Enquanto `isLoading` estiver `true`, uma requisição remota é feita em segundo plano para buscar um dicionário atualizado.
211
- - Uma vez que a busca é concluída, `title` e `description` são atualizados com o conteúdo mais recente, e `isLoading` retorna para `false`.
212
-
213
- ## Tratamento da Localização de Atributos
214
-
215
- Assim como com `useIntlayer`, você pode recuperar valores localizados para atributos de várias propriedades HTML (por exemplo, `alt`, `title`, `aria-label`):
216
-
217
- ```tsx
218
- <img src={title.image.src.value} alt={title.image.alt.value} />
219
- ```
220
-
221
- ## Arquivos de Dicionário
222
-
223
- Todas as chaves de conteúdo devem ser definidas em seus arquivos de declaração de conteúdo para garantir segurança de tipo e evitar erros em tempo de execução. Esses arquivos permitem a validação do TypeScript, assegurando que você sempre referencie chaves e locais existentes.
224
-
225
- Instruções para configurar arquivos de declaração de conteúdo estão disponíveis [aqui](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/get_started.md).
226
-
227
- ## Mais Informações
228
-
229
- - **Editor Visual Intlayer:**
230
- Integre com o editor visual Intlayer para gerenciar e editar conteúdo diretamente pela interface do usuário. Mais detalhes [aqui](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_visual_editor.md).
231
-
232
- ---
233
-
234
- **Em resumo**, `useIntlayerAsync` é um poderoso hook do lado do cliente projetado para melhorar a experiência do usuário e manter o conteúdo atualizado ao combinar dicionários pré-renderizados com atualizações assíncronas de dicionários. Aproveitando `isLoading` e declarações de conteúdo baseadas em TypeScript, você pode integrar perfeitamente conteúdo dinâmico e localizado em suas aplicações Next.js.
235
-
236
- ## Histórico do Documento
237
-
238
- - 5.5.10 - 2025-06-29: Histórico inicial