@intlayer/docs 5.7.6 → 5.7.8
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/dist/cjs/generated/docs.entry.cjs +44 -238
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +44 -238
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -2
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/CI_CD.md +67 -41
- package/docs/ar/intlayer_with_tanstack.md +457 -0
- package/docs/ar/packages/next-intlayer/index.md +0 -1
- package/docs/ar/packages/react-intlayer/index.md +0 -1
- package/docs/de/CI_CD.md +63 -37
- package/docs/de/intlayer_with_tanstack.md +458 -0
- package/docs/de/packages/next-intlayer/index.md +0 -1
- package/docs/de/packages/react-intlayer/index.md +0 -1
- package/docs/en/CI_CD.md +51 -27
- package/docs/en/intlayer_with_tanstack.md +452 -0
- package/docs/en/packages/next-intlayer/index.md +0 -1
- package/docs/en/packages/react-intlayer/index.md +0 -1
- package/docs/en-GB/CI_CD.md +58 -32
- package/docs/en-GB/intlayer_with_tanstack.md +457 -0
- package/docs/en-GB/packages/next-intlayer/index.md +0 -1
- package/docs/en-GB/packages/react-intlayer/index.md +0 -1
- package/docs/es/CI_CD.md +68 -42
- package/docs/es/intlayer_with_tanstack.md +435 -0
- package/docs/es/packages/next-intlayer/index.md +0 -1
- package/docs/es/packages/react-intlayer/index.md +0 -1
- package/docs/fr/intlayer_with_tanstack.md +435 -0
- package/docs/fr/packages/next-intlayer/index.md +0 -1
- package/docs/fr/packages/react-intlayer/index.md +0 -1
- package/docs/hi/CI_CD.md +69 -44
- package/docs/hi/intlayer_with_tanstack.md +438 -0
- package/docs/hi/packages/next-intlayer/index.md +0 -1
- package/docs/hi/packages/react-intlayer/index.md +0 -1
- package/docs/it/CI_CD.md +67 -41
- package/docs/it/intlayer_with_tanstack.md +457 -0
- package/docs/it/packages/next-intlayer/index.md +0 -1
- package/docs/it/packages/react-intlayer/index.md +0 -1
- package/docs/ja/CI_CD.md +67 -41
- package/docs/ja/intlayer_with_tanstack.md +457 -0
- package/docs/ja/packages/next-intlayer/index.md +0 -1
- package/docs/ja/packages/react-intlayer/index.md +0 -1
- package/docs/ko/CI_CD.md +63 -37
- package/docs/ko/intlayer_with_tanstack.md +457 -0
- package/docs/ko/packages/next-intlayer/index.md +0 -1
- package/docs/ko/packages/react-intlayer/index.md +0 -1
- package/docs/pt/CI_CD.md +67 -41
- package/docs/pt/intlayer_with_tanstack.md +457 -0
- package/docs/pt/packages/next-intlayer/index.md +0 -1
- package/docs/pt/packages/react-intlayer/index.md +0 -1
- package/docs/ru/CI_CD.md +70 -44
- package/docs/ru/intlayer_with_tanstack.md +458 -0
- package/docs/ru/packages/next-intlayer/index.md +0 -1
- package/docs/ru/packages/react-intlayer/index.md +0 -1
- package/docs/zh/CI_CD.md +62 -36
- package/docs/zh/intlayer_with_tanstack.md +435 -0
- package/docs/zh/packages/next-intlayer/index.md +0 -1
- package/docs/zh/packages/react-intlayer/index.md +0 -1
- package/package.json +9 -9
- package/src/generated/docs.entry.ts +44 -238
- package/docs/ar/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/ar/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/de/packages/next-intlayer/useIntlayerAsync.md +0 -262
- package/docs/de/packages/react-intlayer/useIntlayerAsync.md +0 -256
- package/docs/en/packages/next-intlayer/useIntlayerAsync.md +0 -239
- package/docs/en/packages/react-intlayer/useIntlayerAsync.md +0 -254
- package/docs/en-GB/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/en-GB/packages/react-intlayer/useIntlayerAsync.md +0 -257
- package/docs/es/packages/next-intlayer/useIntlayerAsync.md +0 -240
- package/docs/es/packages/react-intlayer/useIntlayerAsync.md +0 -276
- package/docs/fr/packages/next-intlayer/useIntlayerAsync.md +0 -238
- package/docs/fr/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/hi/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/hi/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/it/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/it/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/ja/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/ja/packages/react-intlayer/useIntlayerAsync.md +0 -268
- package/docs/ko/packages/next-intlayer/useIntlayerAsync.md +0 -260
- package/docs/ko/packages/react-intlayer/useIntlayerAsync.md +0 -271
- package/docs/pt/packages/next-intlayer/useIntlayerAsync.md +0 -238
- package/docs/pt/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/ru/packages/next-intlayer/useIntlayerAsync.md +0 -237
- package/docs/ru/packages/react-intlayer/useIntlayerAsync.md +0 -252
- package/docs/zh/packages/next-intlayer/useIntlayerAsync.md +0 -239
- package/docs/zh/packages/react-intlayer/useIntlayerAsync.md +0 -257
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
createdAt: 2024-08-11
|
|
3
|
-
updatedAt: 2025-06-29
|
|
4
|
-
title: Documentation du Hook useIntlayerAsync | react-intlayer
|
|
5
|
-
description: Découvrez comment utiliser le hook useIntlayerAsync pour le package react-intlayer
|
|
6
|
-
keywords:
|
|
7
|
-
- useIntlayerAsync
|
|
8
|
-
- dictionnaire
|
|
9
|
-
- clé
|
|
10
|
-
- Intlayer
|
|
11
|
-
- Internationalisation
|
|
12
|
-
- Documentation
|
|
13
|
-
- Next.js
|
|
14
|
-
- JavaScript
|
|
15
|
-
- React
|
|
16
|
-
slugs:
|
|
17
|
-
- doc
|
|
18
|
-
- packages
|
|
19
|
-
- react-intlayer
|
|
20
|
-
- useIntlayerAsync
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
# Intégration React : Documentation du Hook `useIntlayerAsync`
|
|
24
|
-
|
|
25
|
-
Le hook `useIntlayerAsync` étend la fonctionnalité de `useIntlayer` en ne se contentant pas de retourner des dictionnaires pré-rendus, mais en récupérant également les mises à jour de manière asynchrone, ce qui le rend idéal pour les applications qui mettent fréquemment à jour leur contenu localisé après le rendu initial.
|
|
26
|
-
|
|
27
|
-
## Vue d'ensemble
|
|
28
|
-
|
|
29
|
-
- **Chargement asynchrone des dictionnaires :**
|
|
30
|
-
Lors du montage initial, `useIntlayerAsync` retourne d'abord tout dictionnaire de locale pré-récupéré ou empaqueté statiquement (tout comme `useIntlayer` le ferait), puis récupère et fusionne de manière asynchrone tout dictionnaire distant nouvellement disponible.
|
|
31
|
-
- **Gestion de l'état de progression :**
|
|
32
|
-
Le hook fournit également un état `isLoading`, indiquant lorsqu'un dictionnaire distant est en cours de récupération. Cela permet aux développeurs d'afficher des indicateurs de chargement ou des états de squelette pour une expérience utilisateur plus fluide.
|
|
33
|
-
|
|
34
|
-
## Configuration de l'environnement
|
|
35
|
-
|
|
36
|
-
Intlayer fournit un système de gestion de source de contenu (CSM) sans interface (headless) qui permet aux non-développeurs de gérer et de mettre à jour le contenu des applications de manière fluide. En utilisant le tableau de bord intuitif d'Intlayer, votre équipe peut éditer les textes localisés, les images et d'autres ressources sans modifier directement le code. Cela simplifie le processus de gestion de contenu, favorise la collaboration et garantit que les mises à jour peuvent être effectuées rapidement et facilement.
|
|
37
|
-
|
|
38
|
-
Pour commencer avec Intlayer :
|
|
39
|
-
|
|
40
|
-
1. **Inscrivez-vous et obtenez un jeton d'accès** sur [https://intlayer.org/dashboard](https://intlayer.org/dashboard).
|
|
41
|
-
2. **Ajoutez les identifiants à votre fichier de configuration :**
|
|
42
|
-
Dans votre projet React, configurez le client Intlayer avec vos identifiants :
|
|
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. **Pousser un nouveau dictionnaire de langue vers Intlayer :**
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npx intlayer dictionary push -d my-first-dictionary-key
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Cette commande télécharge vos dictionnaires de contenu initiaux, les rendant disponibles pour une récupération et une édition asynchrones via la plateforme Intlayer.
|
|
91
|
-
|
|
92
|
-
## Importer `useIntlayerAsync` dans React
|
|
93
|
-
|
|
94
|
-
Dans vos composants React, importez `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
|
-
## Paramètres
|
|
109
|
-
|
|
110
|
-
1. **`key`** :
|
|
111
|
-
**Type** : `DictionaryKeys`
|
|
112
|
-
La clé du dictionnaire utilisée pour identifier le bloc de contenu localisé. Cette clé doit être définie dans vos fichiers de déclaration de contenu.
|
|
113
|
-
|
|
114
|
-
2. **`locale`** (optionnel) :
|
|
115
|
-
**Type** : `Locales`
|
|
116
|
-
La locale spécifique que vous souhaitez cibler. Si elle est omise, le hook utilise la locale du contexte Intlayer actuel.
|
|
117
|
-
|
|
118
|
-
3. **`isRenderEditor`** (optionnel, par défaut à `true`) :
|
|
119
|
-
**Type** : `boolean`
|
|
120
|
-
Détermine si le contenu doit être prêt à être rendu avec la superposition de l'éditeur Intlayer. Si défini à `false`, les données du dictionnaire retournées excluront les fonctionnalités spécifiques à l'éditeur.
|
|
121
|
-
|
|
122
|
-
## Valeur de retour
|
|
123
|
-
|
|
124
|
-
Le hook retourne un objet dictionnaire contenant le contenu localisé indexé par `key` et `locale`. Il inclut également un booléen `isLoading` indiquant si un dictionnaire distant est en cours de récupération.
|
|
125
|
-
|
|
126
|
-
## Exemple d'utilisation dans un composant React
|
|
127
|
-
|
|
128
|
-
```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
|
|
129
|
-
import { useEffect, type FC } from "react";
|
|
130
|
-
import { useIntlayerAsync } from "react-intlayer";
|
|
131
|
-
|
|
132
|
-
export const ComponentExample: FC = () => {
|
|
133
|
-
const { title, description, isLoading } = useIntlayerAsync("async-component");
|
|
134
|
-
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
if (isLoading) {
|
|
137
|
-
console.log("Le contenu est en cours de chargement...");
|
|
138
|
-
}
|
|
139
|
-
}, [isLoading]);
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<div>
|
|
143
|
-
{isLoading ? (
|
|
144
|
-
<div>
|
|
145
|
-
<h1>Chargement…</h1>
|
|
146
|
-
<p>Veuillez patienter pendant la mise à jour du contenu.</p>
|
|
147
|
-
</div>
|
|
148
|
-
) : (
|
|
149
|
-
<div>
|
|
150
|
-
<h1>{title.value}</h1>
|
|
151
|
-
<p>{description.value}</p>
|
|
152
|
-
</div>
|
|
153
|
-
)}
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
};
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```jsx fileName="src/components/ComponentExample.mjx" codeFormat="esm"
|
|
160
|
-
import { useEffect } from "react";
|
|
161
|
-
import { useIntlayerAsync } from "react-intlayer";
|
|
162
|
-
|
|
163
|
-
const ComponentExample = () => {
|
|
164
|
-
const { title, description, isLoading } = useIntlayerAsync("async-component");
|
|
165
|
-
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
if (isLoading) {
|
|
168
|
-
console.log("Le contenu est en cours de chargement...");
|
|
169
|
-
}
|
|
170
|
-
}, [isLoading]);
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<div>
|
|
174
|
-
{isLoading ? (
|
|
175
|
-
<div>
|
|
176
|
-
<h1>Chargement…</h1>
|
|
177
|
-
<p>Veuillez patienter pendant la mise à jour du contenu.</p>
|
|
178
|
-
</div>
|
|
179
|
-
) : (
|
|
180
|
-
<div>
|
|
181
|
-
<h1>{title.value}</h1>
|
|
182
|
-
<p>{description.value}</p>
|
|
183
|
-
</div>
|
|
184
|
-
)}
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
```jsx fileName="src/components/ComponentExample.csx" codeFormat="commonjs"
|
|
191
|
-
const { useEffect } = require("react");
|
|
192
|
-
const { useIntlayerAsync } = require("react-intlayer");
|
|
193
|
-
|
|
194
|
-
const ComponentExample = () => {
|
|
195
|
-
const { title, description, isLoading } = useIntlayerAsync("async-component");
|
|
196
|
-
|
|
197
|
-
useEffect(() => {
|
|
198
|
-
if (isLoading) {
|
|
199
|
-
console.log("Le contenu est en cours de chargement...");
|
|
200
|
-
}
|
|
201
|
-
}, [isLoading]);
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<div>
|
|
205
|
-
{isLoading ? (
|
|
206
|
-
<div>
|
|
207
|
-
<h1>Chargement…</h1>
|
|
208
|
-
<p>Veuillez patienter pendant la mise à jour du contenu.</p>
|
|
209
|
-
</div>
|
|
210
|
-
) : (
|
|
211
|
-
<div>
|
|
212
|
-
<h1>{title.value}</h1>
|
|
213
|
-
<p>{description.value}</p>
|
|
214
|
-
</div>
|
|
215
|
-
)}
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
};
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
**Points clés :**
|
|
222
|
-
|
|
223
|
-
- Lors du rendu initial, `title` et `description` proviennent du dictionnaire de locale préchargé ou intégré statiquement.
|
|
224
|
-
- Tant que `isLoading` est `true`, une requête en arrière-plan récupère un dictionnaire mis à jour.
|
|
225
|
-
- Une fois la récupération terminée, `title` et `description` sont mis à jour avec le contenu le plus récent, et `isLoading` revient à `false`.
|
|
226
|
-
|
|
227
|
-
## Gestion de la localisation des attributs
|
|
228
|
-
|
|
229
|
-
Vous pouvez également récupérer des valeurs localisées pour divers attributs HTML (par exemple, `alt`, `title`, `aria-label`) :
|
|
230
|
-
|
|
231
|
-
```jsx
|
|
232
|
-
<img src={title.image.src.value} alt={title.image.alt.value} />
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Fichiers de dictionnaire
|
|
236
|
-
|
|
237
|
-
Toutes les clés de contenu doivent être définies dans vos fichiers de déclaration de contenu pour garantir la sécurité des types et éviter les erreurs à l'exécution. Ces fichiers permettent la validation TypeScript, assurant que vous référencez toujours des clés et des locales existantes.
|
|
238
|
-
|
|
239
|
-
Les instructions pour configurer les fichiers de déclaration de contenu sont disponibles [ici](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/get_started.md).
|
|
240
|
-
|
|
241
|
-
## Informations complémentaires
|
|
242
|
-
|
|
243
|
-
- **Éditeur Visuel Intlayer :**
|
|
244
|
-
Intégrez l’éditeur visuel Intlayer pour gérer et éditer le contenu directement depuis l’interface utilisateur. Plus de détails [ici](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_visual_editor.md).
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
**En résumé**, `useIntlayerAsync` est un hook React puissant conçu pour améliorer l'expérience utilisateur et maintenir la fraîcheur du contenu en fusionnant des dictionnaires pré-rendus ou pré-récupérés avec des mises à jour asynchrones des dictionnaires. En tirant parti de `isLoading` et des déclarations de contenu basées sur TypeScript, vous pouvez intégrer de manière transparente un contenu dynamique et localisé dans vos applications React.
|
|
249
|
-
|
|
250
|
-
## Historique de la documentation
|
|
251
|
-
|
|
252
|
-
- 5.5.10 - 2025-06-29 : Historique initial
|
|
@@ -1,237 +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
|
-
- शब्दकोश
|
|
9
|
-
- कुंजी
|
|
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
|
-
सामग्री घोषणा फ़ाइलों को सेट अप करने के निर्देश [यहाँ](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/get_started.md) उपलब्ध हैं।
|
|
225
|
-
|
|
226
|
-
## आगे की जानकारी
|
|
227
|
-
|
|
228
|
-
- **Intlayer विज़ुअल एडिटर:**
|
|
229
|
-
UI से सीधे सामग्री प्रबंधन और संपादन के लिए Intlayer विज़ुअल एडिटर के साथ एकीकरण करें। अधिक विवरण [यहाँ](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_visual_editor.md) देखें।
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
**सारांश में**, `useIntlayerAsync` एक शक्तिशाली क्लाइंट-साइड हुक है जिसे उपयोगकर्ता अनुभव को बेहतर बनाने और सामग्री की ताजगी बनाए रखने के लिए डिज़ाइन किया गया है, जो प्री-रेंडर्ड शब्दकोशों को असिंक्रोनस शब्दकोश अपडेट्स के साथ जोड़ता है। `isLoading` और TypeScript-आधारित सामग्री घोषणाओं का उपयोग करके, आप अपने Next.js अनुप्रयोगों में गतिशील, स्थानीयकृत सामग्री को सहजता से एकीकृत कर सकते हैं।
|
|
234
|
-
|
|
235
|
-
## दस्तावेज़ इतिहास
|
|
236
|
-
|
|
237
|
-
- 5.5.10 - 2025-06-29: प्रारंभिक इतिहास
|