@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,268 +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
- - 辞書
9
- - キー
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
- Reactコンポーネント内で、`useIntlayerAsync`をインポートします:
111
-
112
- ```ts codeFormat="typescript"
113
- import { useIntlayerAsync } from "react-intlayer";
114
- ```
115
-
116
- ```js codeFormat="esm"
117
- import { useIntlayerAsync } from "react-intlayer";
118
- ```
119
-
120
- ```js codeFormat="commonjs"
121
- const { useIntlayerAsync } = require("react-intlayer");
122
- ```
123
-
124
- ## パラメータ
125
-
126
- 1. **`key`**:
127
- **タイプ**: `DictionaryKeys`
128
- ローカライズされたコンテンツブロックを識別するために使用される辞書キーです。このキーはコンテンツ宣言ファイルで定義されている必要があります。
129
-
130
- 2. **`locale`**(オプション):
131
- **タイプ**: `Locales`
132
- 対象とする特定のロケールです。省略した場合、フックは現在のIntlayerコンテキストのロケールを使用します。
133
-
134
- 3. **`isRenderEditor`**(オプション、デフォルトは`true`):
135
- **タイプ**: `boolean`
136
- コンテンツがIntlayerエディターのオーバーレイでレンダリング可能な状態にするかどうかを決定します。`false`に設定すると、返される辞書データにはエディター固有の機能が含まれません。
137
-
138
- ## 戻り値
139
-
140
- フックは、`key` と `locale` をキーとしたローカライズされたコンテンツを含む辞書オブジェクトを返します。また、リモート辞書が現在取得中であるかを示す `isLoading` ブール値も含まれます。
141
-
142
- ## Reactコンポーネントでの使用例
143
-
144
- ```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
145
- import { useEffect, type FC } from "react";
146
- import { useIntlayerAsync } from "react-intlayer";
147
-
148
- export const ComponentExample: FC = () => {
149
- const { title, description, isLoading } = useIntlayerAsync("async-component");
150
-
151
- useEffect(() => {
152
- if (isLoading) {
153
- console.log("コンテンツを読み込み中...");
154
- }
155
- }, [isLoading]);
156
-
157
- return (
158
- <div>
159
- {isLoading ? (
160
- <div>
161
- <h1>読み込み中…</h1>
162
- <p>コンテンツの更新をお待ちください。</p>
163
- </div>
164
- ) : (
165
- <div>
166
- <h1>{title.value}</h1>
167
- <p>{description.value}</p>
168
- </div>
169
- )}
170
- </div>
171
- );
172
- };
173
- ```
174
-
175
- ```jsx fileName="src/components/ComponentExample.mjx" codeFormat="esm"
176
- import { useEffect } from "react";
177
- import { useIntlayerAsync } from "react-intlayer";
178
-
179
- const ComponentExample = () => {
180
- const { title, description, isLoading } = useIntlayerAsync("async-component");
181
-
182
- useEffect(() => {
183
- if (isLoading) {
184
- console.log("コンテンツを読み込み中です...");
185
- }
186
- }, [isLoading]);
187
-
188
- return (
189
- <div>
190
- {isLoading ? (
191
- <div>
192
- <h1>読み込み中…</h1>
193
- <p>コンテンツの更新をお待ちください。</p>
194
- </div>
195
- ) : (
196
- <div>
197
- <h1>{title.value}</h1>
198
- <p>{description.value}</p>
199
- </div>
200
- )}
201
- </div>
202
- );
203
- };
204
- ```
205
-
206
- ```jsx fileName="src/components/ComponentExample.csx" codeFormat="commonjs"
207
- const { useEffect } = require("react");
208
- const { useIntlayerAsync } = require("react-intlayer");
209
-
210
- const ComponentExample = () => {
211
- const { title, description, isLoading } = useIntlayerAsync("async-component");
212
-
213
- useEffect(() => {
214
- if (isLoading) {
215
- console.log("コンテンツを読み込み中...");
216
- }
217
- }, [isLoading]);
218
-
219
- return (
220
- <div>
221
- {isLoading ? (
222
- <div>
223
- <h1>読み込み中…</h1>
224
- <p>コンテンツの更新をお待ちください。</p>
225
- </div>
226
- ) : (
227
- <div>
228
- <h1>{title.value}</h1>
229
- <p>{description.value}</p>
230
- </div>
231
- )}
232
- </div>
233
- );
234
- };
235
- ```
236
-
237
- **重要なポイント:**
238
-
239
- - 初回レンダリング時、`title` と `description` は事前に取得された、または静的に埋め込まれたロケール辞書から取得されます。
240
- - `isLoading` が `true` の間は、バックグラウンドで更新された辞書を取得するリクエストが行われます。
241
- - 取得が完了すると、`title` と `description` は最新のコンテンツに更新され、`isLoading` は `false` に戻ります。
242
-
243
- ## 属性のローカライズ対応
244
-
245
- `alt`、`title`、`aria-label` などの様々なHTML属性のローカライズされた値も取得できます:
246
-
247
- ```jsx
248
- <img src={title.image.src.value} alt={title.image.alt.value} />
249
- ```
250
-
251
- ## 辞書ファイル
252
-
253
- すべてのコンテンツキーは型安全性を確保し、実行時エラーを防ぐためにコンテンツ宣言ファイルで定義する必要があります。これらのファイルはTypeScriptの検証を可能にし、常に存在するキーとロケールを参照していることを保証します。
254
-
255
- コンテンツ宣言ファイルの設定手順は[こちら](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/get_started.md)でご覧いただけます。
256
-
257
- ## さらに詳しく
258
-
259
- - **Intlayer ビジュアルエディター:**
260
- UIから直接コンテンツの管理や編集を行うために、Intlayerビジュアルエディターと統合できます。詳細は[こちら](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_visual_editor.md)をご覧ください。
261
-
262
- ---
263
-
264
- **まとめ**、`useIntlayerAsync` は、プリレンダリングまたは事前取得された辞書と非同期の辞書更新を統合することで、ユーザー体験を向上させ、コンテンツの鮮度を維持するために設計された強力な React フックです。`isLoading` と TypeScript ベースのコンテンツ宣言を活用することで、動的でローカライズされたコンテンツを React アプリケーションにシームレスに統合できます。
265
-
266
- ## ドキュメント履歴
267
-
268
- - 5.5.10 - 2025-06-29: 履歴の初期化
@@ -1,260 +0,0 @@
1
- ---
2
- createdAt: 2024-08-11
3
- updatedAt: 2025-06-29
4
- title: useIntlayerAsync 훅 문서 | next-intlayer
5
- description: next-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
- - next-intlayer
20
- - useIntlayerAsync
21
- ---
22
-
23
- # Next.js 통합: `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를 시작하려면 먼저 [대시보드](https://intlayer.org/dashboard)에서 등록하고 액세스 토큰을 받아야 합니다. 자격 증명을 받으면 아래와 같이 구성 파일에 추가하세요:
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
- 자격 증명을 구성한 후에는 다음 명령어를 실행하여 Intlayer에 새 로케일 사전을 푸시할 수 있습니다:
81
-
82
- ```bash
83
- npx intlayer dictionary push -d my-first-dictionary-key
84
- ```
85
-
86
- 이 명령어는 초기 콘텐츠 사전을 업로드하여 Intlayer 플랫폼을 통해 비동기적으로 가져오고 편집할 수 있도록 만듭니다.
87
-
88
- ## Next.js에서 `useIntlayerAsync` 가져오기
89
-
90
- `useIntlayerAsync`는 **클라이언트 사이드** 컴포넌트를 위해 설계되었으므로, `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
- Next.js App Router에서 서버와 클라이언트 컴포넌트가 분리되어 있을 경우, 해당 파일 상단에 `"use client"`가 명시되어 있는지 확인하세요.
111
-
112
- ## 매개변수
113
-
114
- 1. **`key`**:
115
- **타입**: `DictionaryKeys`
116
- 지역화된 콘텐츠 블록을 식별하는 데 사용되는 사전 키입니다. 이 키는 콘텐츠 선언 파일에 정의되어 있어야 합니다.
117
-
118
- 2. **`locale`** (선택 사항):
119
- **타입**: `Locales`
120
- 대상이 되는 특정 로케일입니다. 생략할 경우, 훅은 클라이언트 컨텍스트의 로케일을 사용합니다.
121
-
122
- 3. **`isRenderEditor`** (선택 사항, 기본값은 `true`):
123
- **타입**: `boolean`
124
- 콘텐츠가 Intlayer 편집기 오버레이와 함께 렌더링 준비가 되어야 하는지 여부를 결정합니다. `false`로 설정하면 반환된 사전 데이터에 편집기 전용 기능이 제외됩니다.
125
-
126
- ## 반환 값
127
-
128
- 이 훅은 `key`와 `locale`을 키로 하는 현지화된 콘텐츠가 포함된 사전 객체를 반환합니다. 또한 원격 사전을 현재 가져오는 중인지 여부를 나타내는 `isLoading` 불리언도 포함합니다.
129
-
130
- ## Next.js에서의 사용 예시
131
-
132
- ### 클라이언트 사이드 컴포넌트 예시
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("콘텐츠를 불러오는 중입니다...");
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("콘텐츠를 불러오는 중입니다...");
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("콘텐츠가 로딩 중입니다...");
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
- **핵심 사항:**
207
-
208
- - 초기 렌더링 시, `title`과 `description`은 미리 렌더링된 로케일 사전에서 가져옵니다.
209
- - `isLoading`이 `true`인 동안, 백그라운드에서 원격 요청이 이루어져 업데이트된 사전을 가져옵니다.
210
- - 요청이 완료되면 `title`과 `description`이 최신 콘텐츠로 업데이트되고, `isLoading`은 다시 `false`로 돌아갑니다.
211
-
212
- ## 속성 현지화 처리
213
-
214
- `useIntlayer`와 마찬가지로, 다양한 HTML 속성(예: `alt`, `title`, `aria-label`)에 대한 현지화된 속성 값을 가져올 수 있습니다:
215
-
216
- ```tsx
217
- <img src={title.image.src.value} alt={title.image.alt.value} />
218
- ```
219
-
220
- ## 사전 파일
221
-
222
- 모든 콘텐츠 키는 타입 안전성과 런타임 오류 방지를 위해 콘텐츠 선언 파일에 정의되어야 합니다. 이 파일들은 TypeScript 검증을 가능하게 하여 항상 존재하는 키와 로케일을 참조하도록 보장합니다.
223
-
224
- /// `isLoading`이 `true`인 동안, 백그라운드에서 원격 요청이 이루어져 최신 사전을 가져옵니다.
225
- /// 요청이 완료되면 `title`과 `description`이 최신 내용으로 업데이트되고, `isLoading`은 다시 `false`로 돌아갑니다.
226
-
227
- ## 속성 현지화 처리
228
-
229
- `useIntlayer`와 마찬가지로, 다양한 HTML 속성(예: `alt`, `title`, `aria-label`)에 대해 현지화된 속성 값을 가져올 수 있습니다:
230
-
231
- ```tsx
232
- <img src={title.image.src.value} alt={title.image.alt.value} />
233
- ```
234
-
235
- ## 사전 파일
236
-
237
- 모든 콘텐츠 키는 타입 안전성과 런타임 오류 방지를 위해 콘텐츠 선언 파일에 정의되어야 합니다. 이 파일들은 TypeScript 검증을 가능하게 하여 항상 존재하는 키와 로케일만 참조하도록 보장합니다.
238
-
239
- 콘텐츠 선언 파일 설정 방법은 [여기](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/dictionary/get_started.md)에서 확인할 수 있습니다.
240
-
241
- ## 추가 정보
242
-
243
- - **Intlayer 비주얼 에디터:**
244
- Intlayer 비주얼 에디터와 통합하여 UI에서 직접 콘텐츠를 관리하고 편집할 수 있습니다. 자세한 내용은 [여기](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/intlayer_visual_editor.md)에서 확인하세요.
245
-
246
- ---
247
-
248
- **요약하자면**, `useIntlayerAsync`는 사전의 사전 렌더링과 비동기 사전 업데이트를 결합하여 사용자 경험을 향상시키고 콘텐츠 신선도를 유지하는 강력한 클라이언트 사이드 훅입니다. `isLoading`과 TypeScript 기반 콘텐츠 선언을 활용하여 Next.js 애플리케이션에 동적이고 현지화된 콘텐츠를 원활하게 통합할 수 있습니다.
249
-
250
- ## 문서 이력
251
-
252
- - 5.5.10 - 2025-06-29: 이력 초기화
253
-
254
- ---
255
-
256
- **요약하면**, `useIntlayerAsync`는 사전 렌더링된 사전과 비동기 사전 업데이트를 결합하여 사용자 경험을 향상시키고 콘텐츠 신선도를 유지하도록 설계된 강력한 클라이언트 사이드 훅입니다. `isLoading`과 TypeScript 기반 콘텐츠 선언을 활용하여 Next.js 애플리케이션에 동적이고 지역화된 콘텐츠를 원활하게 통합할 수 있습니다.
257
-
258
- ## 문서 이력
259
-
260
- - 5.5.10 - 2025-06-29: 초기 이력