@intlayer/docs 5.7.4 → 5.7.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.
Files changed (117) hide show
  1. package/blog/ar/intlayer_with_i18next.md +1 -1
  2. package/dist/cjs/common.cjs +0 -1
  3. package/dist/cjs/common.cjs.map +1 -1
  4. package/dist/cjs/generated/docs.entry.cjs +80 -0
  5. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  6. package/dist/esm/common.mjs +0 -1
  7. package/dist/esm/common.mjs.map +1 -1
  8. package/dist/esm/generated/docs.entry.mjs +80 -0
  9. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  10. package/dist/types/common.d.ts.map +1 -1
  11. package/dist/types/generated/docs.entry.d.ts +1 -0
  12. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  13. package/docs/ar/CI_CD.md +0 -1
  14. package/docs/ar/configuration.md +42 -5
  15. package/docs/ar/dictionary/enumeration.md +0 -1
  16. package/docs/ar/packages/react-intlayer/useI18n.md +250 -0
  17. package/docs/de/CI_CD.md +0 -1
  18. package/docs/de/configuration.md +42 -5
  19. package/docs/de/dictionary/gender.md +3 -3
  20. package/docs/de/packages/react-intlayer/useI18n.md +250 -0
  21. package/docs/en/configuration.md +44 -7
  22. package/docs/en/packages/react-intlayer/useI18n.md +250 -0
  23. package/docs/en-GB/configuration.md +42 -5
  24. package/docs/en-GB/packages/react-intlayer/useI18n.md +254 -0
  25. package/docs/es/configuration.md +42 -5
  26. package/docs/es/dictionary/enumeration.md +1 -2
  27. package/docs/es/dictionary/gender.md +3 -3
  28. package/docs/es/locale_mapper.md +1 -1
  29. package/docs/es/packages/react-intlayer/useI18n.md +250 -0
  30. package/docs/fr/configuration.md +44 -7
  31. package/docs/fr/intlayer_with_nextjs_15.md +0 -1
  32. package/docs/fr/intlayer_with_vite+preact.md +1 -1
  33. package/docs/fr/packages/react-intlayer/useI18n.md +250 -0
  34. package/docs/hi/configuration.md +42 -5
  35. package/docs/hi/dictionary/enumeration.md +0 -2
  36. package/docs/hi/packages/react-intlayer/useI18n.md +259 -0
  37. package/docs/it/configuration.md +42 -5
  38. package/docs/it/dictionary/enumeration.md +0 -1
  39. package/docs/it/packages/react-intlayer/useI18n.md +250 -0
  40. package/docs/it/vs_code_extension.md +0 -1
  41. package/docs/ja/configuration.md +43 -28
  42. package/docs/ja/dictionary/enumeration.md +0 -2
  43. package/docs/ja/packages/react-intlayer/useI18n.md +250 -0
  44. package/docs/ko/configuration.md +42 -5
  45. package/docs/ko/dictionary/enumeration.md +0 -2
  46. package/docs/ko/packages/react-intlayer/useI18n.md +250 -0
  47. package/docs/pt/configuration.md +42 -5
  48. package/docs/pt/packages/react-intlayer/useI18n.md +250 -0
  49. package/docs/ru/configuration.md +42 -5
  50. package/docs/ru/dictionary/enumeration.md +0 -2
  51. package/docs/ru/packages/react-intlayer/useI18n.md +250 -0
  52. package/docs/ru/vs_code_extension.md +0 -1
  53. package/docs/zh/configuration.md +42 -5
  54. package/docs/zh/dictionary/enumeration.md +0 -1
  55. package/docs/zh/packages/react-intlayer/useI18n.md +250 -0
  56. package/frequent_questions/ar/unknown_command.md +1 -1
  57. package/frequent_questions/de/array_as_content_declaration.md +1 -1
  58. package/frequent_questions/de/build_dictionaries.md +1 -1
  59. package/frequent_questions/de/build_error_CI_CD.md +1 -1
  60. package/frequent_questions/de/customized_locale_list.md +1 -1
  61. package/frequent_questions/de/esbuild_error.md +1 -1
  62. package/frequent_questions/de/intlayer_command_undefined.md +1 -1
  63. package/frequent_questions/de/locale_incorect_in_url.md +1 -1
  64. package/frequent_questions/de/static_rendering.md +1 -1
  65. package/frequent_questions/de/translated_path_url.md +1 -1
  66. package/frequent_questions/de/unknown_command.md +1 -1
  67. package/frequent_questions/en-GB/customized_locale_list.md +1 -1
  68. package/frequent_questions/es/array_as_content_declaration.md +1 -1
  69. package/frequent_questions/es/build_dictionaries.md +1 -1
  70. package/frequent_questions/es/customized_locale_list.md +1 -1
  71. package/frequent_questions/es/domain_routing.md +1 -1
  72. package/frequent_questions/es/get_locale_cookie.md +1 -1
  73. package/frequent_questions/es/intlayer_command_undefined.md +1 -1
  74. package/frequent_questions/es/locale_incorect_in_url.md +1 -1
  75. package/frequent_questions/es/static_rendering.md +1 -1
  76. package/frequent_questions/es/translated_path_url.md +1 -1
  77. package/frequent_questions/es/unknown_command.md +1 -1
  78. package/frequent_questions/fr/array_as_content_declaration.md +1 -1
  79. package/frequent_questions/fr/build_dictionaries.md +1 -1
  80. package/frequent_questions/fr/customized_locale_list.md +1 -1
  81. package/frequent_questions/fr/domain_routing.md +1 -1
  82. package/frequent_questions/fr/esbuild_error.md +1 -1
  83. package/frequent_questions/fr/intlayer_command_undefined.md +1 -1
  84. package/frequent_questions/fr/static_rendering.md +1 -1
  85. package/frequent_questions/fr/translated_path_url.md +1 -1
  86. package/frequent_questions/fr/unknown_command.md +1 -1
  87. package/frequent_questions/it/array_as_content_declaration.md +1 -1
  88. package/frequent_questions/it/build_dictionaries.md +1 -1
  89. package/frequent_questions/it/customized_locale_list.md +1 -1
  90. package/frequent_questions/it/esbuild_error.md +1 -1
  91. package/frequent_questions/it/intlayer_command_undefined.md +1 -1
  92. package/frequent_questions/it/locale_incorect_in_url.md +1 -1
  93. package/frequent_questions/it/static_rendering.md +1 -1
  94. package/frequent_questions/it/translated_path_url.md +1 -1
  95. package/frequent_questions/it/unknown_command.md +1 -1
  96. package/frequent_questions/ko/build_dictionaries.md +2 -2
  97. package/frequent_questions/ko/customized_locale_list.md +3 -3
  98. package/frequent_questions/ko/intlayer_command_undefined.md +3 -3
  99. package/frequent_questions/pt/array_as_content_declaration.md +1 -1
  100. package/frequent_questions/pt/build_dictionaries.md +1 -1
  101. package/frequent_questions/pt/build_error_CI_CD.md +1 -1
  102. package/frequent_questions/pt/customized_locale_list.md +1 -1
  103. package/frequent_questions/pt/domain_routing.md +1 -1
  104. package/frequent_questions/pt/esbuild_error.md +1 -1
  105. package/frequent_questions/pt/intlayer_command_undefined.md +1 -1
  106. package/frequent_questions/pt/locale_incorect_in_url.md +1 -1
  107. package/frequent_questions/pt/static_rendering.md +1 -1
  108. package/frequent_questions/pt/translated_path_url.md +1 -1
  109. package/frequent_questions/pt/unknown_command.md +1 -1
  110. package/frequent_questions/zh/build_dictionaries.md +3 -3
  111. package/frequent_questions/zh/customized_locale_list.md +3 -3
  112. package/frequent_questions/zh/esbuild_error.md +3 -3
  113. package/frequent_questions/zh/intlayer_command_undefined.md +3 -3
  114. package/frequent_questions/zh/translated_path_url.md +3 -3
  115. package/package.json +9 -9
  116. package/src/common.ts +0 -1
  117. package/src/generated/docs.entry.ts +80 -0
@@ -13,7 +13,7 @@ keywords:
13
13
  slugs:
14
14
  - doc
15
15
  - environment
16
- - vite-and-
16
+ - vite-and-preact
17
17
  applicationTemplate: https://github.com/aymericzip/intlayer-vite-preact-template
18
18
  ---
19
19
 
@@ -0,0 +1,250 @@
1
+ ---
2
+ createdAt: 2024-08-11
3
+ updatedAt: 2025-06-29
4
+ title: Documentation du Hook useI18n | react-intlayer
5
+ description: Apprenez à utiliser le hook useI18n dans le package react-intlayer
6
+ keywords:
7
+ - useI18n
8
+ - i18n
9
+ - traduction
10
+ - dictionnaire
11
+ - Intlayer
12
+ - internationalisation
13
+ - documentation
14
+ - Next.js
15
+ - JavaScript
16
+ - React
17
+ slugs:
18
+ - doc
19
+ - packages
20
+ - react-intlayer
21
+ - useI18n
22
+ ---
23
+
24
+ # Intégration React : Documentation du Hook `useI18n`
25
+
26
+ Cette section fournit des instructions détaillées sur la manière d’utiliser le hook `useI18n` dans les applications React, permettant une localisation efficace du contenu.
27
+
28
+ ## Importer `useI18n` dans React
29
+
30
+ Le hook `useI18n` peut être importé et intégré dans les applications React selon le contexte comme suit :
31
+
32
+ - **Composants Client :**
33
+
34
+ ```typescript codeFormat="typescript"
35
+ import { useI18n } from "react-intlayer"; // Utiliser dans les composants React côté client
36
+ ```
37
+
38
+ ```javascript codeFormat="esm"
39
+ import { useI18n } from "react-intlayer"; // Utiliser dans les composants React côté client
40
+ ```
41
+
42
+ ```javascript codeFormat="commonjs"
43
+ const { useI18n } = require("react-intlayer"); // Utiliser dans les composants React côté client
44
+ ```
45
+
46
+ - **Composants Serveur :**
47
+
48
+ ```typescript codeFormat="commonjs"
49
+ import { useI18n } from "react-intlayer/server"; // Utiliser dans les composants React côté serveur
50
+ ```
51
+
52
+ ```javascript codeFormat="esm"
53
+ import { useI18n } from "react-intlayer/server"; // Utiliser dans les composants React côté serveur
54
+ ```
55
+
56
+ ```javascript codeFormat="commonjs"
57
+ const { useI18n } = require("react-intlayer/server"); // Utiliser dans les composants React côté serveur
58
+ ```
59
+
60
+ ## Paramètres
61
+
62
+ Ce hook accepte deux paramètres :
63
+
64
+ 1. **`namespace`** : Un espace de noms de dictionnaire pour délimiter les clés de traduction.
65
+ 2. **`locale`** (optionnel) : La locale souhaitée. Si elle n'est pas spécifiée, la locale du contexte sera utilisée par défaut.
66
+
67
+ ## Dictionnaire
68
+
69
+ Toutes les clés du dictionnaire doivent être déclarées dans des fichiers de déclaration de contenu afin d'améliorer la sécurité des types et d'éviter les erreurs. [Les instructions de configuration sont disponibles ici](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/dictionary/get_started.md).
70
+
71
+ ## Exemples d'utilisation dans React
72
+
73
+ Exemples d'utilisation du hook `useI18n` dans des composants React :
74
+
75
+ ```tsx fileName="src/App.tsx" codeFormat="typescript"
76
+ import type { FC } from "react";
77
+ import { ClientComponentExample, ServerComponentExample } from "@components";
78
+ import { IntlayerProvider } from "react-intlayer";
79
+ import { useI18n, IntlayerServerProvider } from "react-intlayer/server";
80
+ import { Locales } from "intlayer";
81
+
82
+ const App: FC<{ locale: Locales }> = ({ locale }) => {
83
+ const t = useI18n("home-page", locale);
84
+
85
+ return (
86
+ <>
87
+ <p>{t("introduction")}</p>
88
+ <IntlayerProvider locale={locale}>
89
+ <ClientComponentExample />
90
+ </IntlayerProvider>
91
+ <IntlayerServerProvider locale={locale}>
92
+ <ServerComponentExample />
93
+ </IntlayerServerProvider>
94
+ </>
95
+ );
96
+ };
97
+ ```
98
+
99
+ ```jsx fileName="src/app.jsx" codeFormat="esm"
100
+ import { ClientComponentExample, ServerComponentExample } from "@components";
101
+ import { IntlayerProvider } from "react-intlayer";
102
+ import { IntlayerServerProvider, useI18n } from "react-intlayer/server";
103
+
104
+ const App = ({ locale }) => {
105
+ const t = useI18n("home-page", locale);
106
+
107
+ return (
108
+ <>
109
+ <p>{t("introduction")}</p>
110
+ <IntlayerProvider locale={locale}>
111
+ <ClientComponentExample />
112
+ </IntlayerProvider>
113
+ <IntlayerServerProvider locale={locale}>
114
+ <ServerComponentExample />
115
+ </IntlayerServerProvider>
116
+ </>
117
+ );
118
+ };
119
+ ```
120
+
121
+ ```jsx fileName="src/app.cjs" codeFormat="commonjs"
122
+ const { IntlayerProvider } = require("react-intlayer");
123
+ const { IntlayerServerProvider, useI18n } = require("react-intlayer/server");
124
+
125
+ const App = ({ locale }) => {
126
+ const t = useI18n("home-page", locale);
127
+
128
+ return (
129
+ <>
130
+ <p>{t("introduction")}</p>
131
+ <IntlayerProvider locale={locale}>
132
+ <ClientComponentExample />
133
+ </IntlayerProvider>
134
+ <IntlayerServerProvider locale={locale}>
135
+ <ServerComponentExample />
136
+ </IntlayerServerProvider>
137
+ </>
138
+ );
139
+ };
140
+ ```
141
+
142
+ ```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
143
+ import type { FC } from "react";
144
+ import { useI18n } from "react-intlayer";
145
+
146
+ const ComponentExample: FC = () => {
147
+ const t = useI18n("component-example");
148
+
149
+ return (
150
+ <div>
151
+ <h1>{t("title")}</h1> {/* Affiche le titre */}
152
+ <p>{t("description")}</p> {/* Affiche la description */}
153
+ </div>
154
+ );
155
+ };
156
+ ```
157
+
158
+ ```jsx fileName="src/components/ComponentExample.jsx" codeFormat="esm"
159
+ import { useI18n } from "react-intlayer";
160
+
161
+ const ComponentExample = () => {
162
+ const t = useI18n("component-example");
163
+
164
+ return (
165
+ <div>
166
+ <h1>{t("title")}</h1> {/* Affiche le titre */}
167
+ <p>{t("description")}</p> {/* Affiche la description */}
168
+ </div>
169
+ );
170
+ };
171
+ ```
172
+
173
+ ```jsx fileName="src/components/ComponentExample.cjs" codeFormat="commonjs"
174
+ const { useI18n } = require("react-intlayer");
175
+
176
+ const ComponentExample = () => {
177
+ const t = useI18n("component-example");
178
+
179
+ return (
180
+ <div>
181
+ <h1>{t("title")}</h1> {/* Affiche le titre */}
182
+ <p>{t("description")}</p> {/* Affiche la description */}
183
+ </div>
184
+ );
185
+ };
186
+ ```
187
+
188
+ ```tsx fileName="src/components/ServerComponentExample.tsx" codeFormat="typescript"
189
+ import { useI18n } from "react-intlayer/server";
190
+
191
+ const ServerComponentExample = () => {
192
+ const t = useI18n("server-component");
193
+
194
+ return (
195
+ <div>
196
+ <h1>{t("title")}</h1> {/* Affiche le titre */}
197
+ <p>{t("description")}</p> {/* Affiche la description */}
198
+ </div>
199
+ );
200
+ };
201
+ ```
202
+
203
+ ```jsx fileName="src/components/ServerComponentExample.jsx" codeFormat="esm"
204
+ import { useI18n } from "react-intlayer/server";
205
+
206
+ const ServerComponentExample = () => {
207
+ const t = useI18n("server-component");
208
+
209
+ return (
210
+ <div>
211
+ <h1>{t("title")}</h1> {/* Affiche le titre */}
212
+ <p>{t("description")}</p> {/* Affiche la description */}
213
+ </div>
214
+ );
215
+ };
216
+ ```
217
+
218
+ ```jsx fileName="src/components/ServerComponentExample.cjs" codeFormat="commonjs"
219
+ const { useI18n } = require("react-intlayer/server");
220
+
221
+ const ServerComponentExample = () => {
222
+ const t = useI18n("server-component");
223
+
224
+ return (
225
+ <div>
226
+ <h1>{t("title")}</h1>
227
+ <p>{t("description")}</p>
228
+ </div>
229
+ );
230
+ };
231
+ ```
232
+
233
+ ## Gestion des attributs
234
+
235
+ Lors de la localisation des attributs, accédez aux valeurs de traduction de manière appropriée :
236
+
237
+ ```jsx
238
+ <!-- Pour les attributs d'accessibilité (par exemple, aria-label), utilisez .value car des chaînes pures sont requises -->
239
+ <button aria-label={t("button.ariaLabel").value}>{t("button.text")}</button>
240
+ ```
241
+
242
+ ## Ressources supplémentaires
243
+
244
+ - **Éditeur visuel Intlayer** : Pour une expérience de gestion de contenu plus intuitive, consultez la documentation de l'éditeur visuel [ici](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/intlayer_visual_editor.md).
245
+
246
+ Cette section couvre spécifiquement l'intégration du hook `useI18n` dans les applications React, simplifiant le processus de localisation et garantissant la cohérence du contenu à travers différentes locales.
247
+
248
+ ## Historique de la documentation
249
+
250
+ - 6.0.0 - 29-06-2025 : Rédaction initiale de la documentation du hook `useI18n`
@@ -270,10 +270,12 @@ module.exports = config;
270
270
  - **prefixDefault**:
271
271
 
272
272
  - _प्रकार_: `boolean`
273
- - _डिफ़ॉल्ट_: `true`
273
+ - _डिफ़ॉल्ट_: `false`
274
274
  - _विवरण_: क्या URL में डिफ़ॉल्ट लोकेल शामिल करना है।
275
- - _उदाहरण_: `false`
276
- - _नोट_: यदि `false`, तो डिफ़ॉल्ट लोकेल के लिए URL में लोकेल प्रीफ़िक्स नहीं होगा।
275
+ - _उदाहरण_: `true`
276
+ - _नोट_:
277
+ - यदि `true` और `defaultLocale = 'en'`: path = `/en/dashboard` या `/fr/dashboard`
278
+ - यदि `false` और `defaultLocale = 'en'`: path = `/dashboard` या `/fr/dashboard`
277
279
 
278
280
  - **basePath**:
279
281
 
@@ -281,7 +283,11 @@ module.exports = config;
281
283
  - _डिफ़ॉल्ट_: `''`
282
284
  - _विवरण_: एप्लिकेशन URL के लिए बेस पथ।
283
285
  - _उदाहरण_: `'/my-app'`
284
- - _नोट_: यह एप्लिकेशन के लिए URL कैसे बनाए जाते हैं, इसे प्रभावित करता है।
286
+ - _नोट_:
287
+ - यदि एप्लिकेशन `https://example.com/my-app` पर होस्ट की गई है
288
+ - बेस पथ `'/my-app'` है
289
+ - URL `https://example.com/my-app/en` होगा
290
+ - यदि बेस पथ सेट नहीं है, तो URL `https://example.com/en` होगा
285
291
 
286
292
  - **serverSetCookie**:
287
293
 
@@ -293,11 +299,42 @@ module.exports = config;
293
299
  - _नोट_: नियंत्रित करता है कि लोकेल कुकी हर अनुरोध पर सेट की जाए या कभी नहीं।
294
300
 
295
301
  - **noPrefix**:
302
+
296
303
  - _प्रकार_: `boolean`
297
304
  - _डिफ़ॉल्ट_: `false`
298
305
  - _विवरण_: क्या URL से लोकेल प्रीफ़िक्स हटाना है।
299
306
  - _उदाहरण_: `true`
300
- - _नोट_: यदि `true`, तो URL में लोकेल जानकारी शामिल नहीं होगी।
307
+ - _नोट_:
308
+ - यदि `true`: URL में कोई प्रीफ़िक्स नहीं
309
+ - यदि `false`: URL में प्रीफ़िक्स है
310
+ - `basePath = '/my-app'` के साथ उदाहरण:
311
+ - यदि `noPrefix = false`: URL `https://example.com/my-app/en` होगा
312
+ - यदि `noPrefix = true`: URL `https://example.com` होगा
313
+
314
+ - **detectLocaleOnPrefetchNoPrefix**:
315
+
316
+ - _प्रकार_: `boolean`
317
+ - _डिफ़ॉल्ट_: `false`
318
+ - _विवरण_: नियंत्रित करता है कि Next.js प्रीफ़ेच अनुरोधों के दौरान लोकेल पता लगाना होता है या नहीं।
319
+ - _उदाहरण_: `true`
320
+ - _नोट_: यह सेटिंग प्रभावित करती है कि Next.js लोकेल प्रीफ़ेचिंग को कैसे संभालता है:
321
+ - **उदाहरण परिदृश्य:**
322
+ - उपयोगकर्ता का ब्राउज़र भाषा `'fr'` है
323
+ - वर्तमान पृष्ठ `/fr/about` है
324
+ - लिंक प्रीफ़ेच करता है `/about`
325
+ - **`detectLocaleOnPrefetchNoPrefix: true` के साथ:**
326
+ - प्रीफ़ेच ब्राउज़र से `'fr'` लोकेल का पता लगाता है
327
+ - प्रीफ़ेच को `/fr/about` पर रीडायरेक्ट करता है
328
+ - **`detectLocaleOnPrefetchNoPrefix: false` (डिफ़ॉल्ट) के साथ:**
329
+ - प्रीफ़ेच डिफ़ॉल्ट लोकेल का उपयोग करता है
330
+ - प्रीफ़ेच को `/en/about` पर रीडायरेक्ट करता है (यह मानते हुए कि `'en'` डिफ़ॉल्ट है)
331
+ - **कब `true` का उपयोग करें:**
332
+ - आपका ऐप गैर-स्थानीयकृत आंतरिक लिंक का उपयोग करता है (जैसे `<a href="/about">`)
333
+ - आप सामान्य और प्रीफ़ेच अनुरोधों के बीच सुसंगत लोकेल पता लगाने का व्यवहार चाहते हैं
334
+ - **कब `false` (डिफ़ॉल्ट) का उपयोग करें:**
335
+ - आपका ऐप लोकेल-प्रीफ़िक्स वाले लिंक का उपयोग करता है (जैसे `<a href="/fr/about">`)
336
+ - आप प्रीफ़ेचिंग प्रदर्शन को अनुकूलित करना चाहते हैं
337
+ - आप संभावित रीडायरेक्ट लूप से बचना चाहते हैं
301
338
 
302
339
  ---
303
340
 
@@ -15,8 +15,6 @@ slugs:
15
15
  - doc
16
16
  - concept
17
17
  - content
18
- - hi
19
- - dictionary
20
18
  - enumeration
21
19
  ---
22
20
 
@@ -0,0 +1,259 @@
1
+ ---
2
+ createdAt: 2024-08-11
3
+ updatedAt: 2025-06-29
4
+ title: useI18n हुक दस्तावेज़ | react-intlayer
5
+ description: react-intlayer पैकेज में useI18n हुक का उपयोग कैसे करें, जानें
6
+ keywords:
7
+ - useI18n
8
+ - i18n
9
+ - अनुवाद
10
+ - शब्दकोश
11
+ - Intlayer
12
+ - अंतरराष्ट्रीयकरण
13
+ - दस्तावेज़ीकरण
14
+ - Next.js
15
+ - JavaScript
16
+ - React
17
+ slugs:
18
+ - doc
19
+ - packages
20
+ - react-intlayer
21
+ - useI18n
22
+ ---
23
+
24
+ # React एकीकरण: `useI18n` हुक दस्तावेज़
25
+
26
+ यह अनुभाग React अनुप्रयोगों के भीतर `useI18n` हुक का उपयोग कैसे करें, इस पर विस्तृत मार्गदर्शन प्रदान करता है, जिससे कुशल सामग्री स्थानीयकरण सक्षम होता है।
27
+
28
+ ## React में `useI18n` आयात करना
29
+
30
+ `useI18n` हुक को संदर्भ के अनुसार React अनुप्रयोगों में निम्नलिखित तरीके से आयात और एकीकृत किया जा सकता है:
31
+
32
+ - **क्लाइंट कंपोनेंट्स:**
33
+
34
+ ```typescript codeFormat="typescript"
35
+ import { useI18n } from "react-intlayer"; // क्लाइंट-साइड React कंपोनेंट्स में उपयोग करें
36
+ ```
37
+
38
+ ```javascript codeFormat="esm"
39
+ import { useI18n } from "react-intlayer"; // क्लाइंट-साइड React कंपोनेंट्स में उपयोग करें
40
+ ```
41
+
42
+ ```javascript codeFormat="commonjs"
43
+ const { useI18n } = require("react-intlayer"); // क्लाइंट-साइड React कंपोनेंट्स में उपयोग करें
44
+ ```
45
+
46
+ - **सर्वर कंपोनेंट्स:**
47
+
48
+ ```typescript codeFormat="commonjs"
49
+ import { useI18n } from "react-intlayer/server"; // सर्वर-साइड React कंपोनेंट्स में उपयोग करें
50
+ ```
51
+
52
+ ```javascript codeFormat="esm"
53
+ import { useI18n } from "react-intlayer/server"; // सर्वर-साइड React कंपोनेंट्स में उपयोग करें
54
+ ```
55
+
56
+ ```javascript codeFormat="commonjs"
57
+ const { useI18n } = require("react-intlayer/server"); // सर्वर-साइड React कंपोनेंट्स में उपयोग करें
58
+ ```
59
+
60
+ ## पैरामीटर
61
+
62
+ यह हुक दो पैरामीटर स्वीकार करता है:
63
+
64
+ 1. **`namespace`**: अनुवाद कुंजियों के स्कोप के लिए एक शब्दकोश नामस्थान।
65
+ 2. **`locale`** (वैकल्पिक): इच्छित लोकल। यदि निर्दिष्ट नहीं किया गया है, तो संदर्भ का लोकल डिफ़ॉल्ट के रूप में उपयोग किया जाएगा।
66
+
67
+ ## शब्दकोश
68
+
69
+ सभी शब्दकोश कुंजियाँ सामग्री घोषणा फ़ाइलों के भीतर घोषित की जानी चाहिए ताकि प्रकार सुरक्षा बढ़े और त्रुटियों से बचा जा सके। [कॉन्फ़िगरेशन निर्देश यहाँ पाए जा सकते हैं](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/get_started.md)।
70
+
71
+ ## React में उपयोग के उदाहरण
72
+
73
+ React कंपोनेंट्स के भीतर `useI18n` हुक का उपयोग करने के उदाहरण:
74
+
75
+ ```tsx fileName="src/App.tsx" codeFormat="typescript"
76
+ import type { FC } from "react";
77
+ import { ClientComponentExample, ServerComponentExample } from "@components";
78
+ import { IntlayerProvider } from "react-intlayer";
79
+ import { useI18n, IntlayerServerProvider } from "react-intlayer/server";
80
+ import { Locales } from "intlayer";
81
+
82
+ const App: FC<{ locale: Locales }> = ({ locale }) => {
83
+ const t = useI18n("home-page", locale);
84
+
85
+ return (
86
+ <>
87
+ <p>{t("introduction")}</p>
88
+ <IntlayerProvider locale={locale}>
89
+ <ClientComponentExample />
90
+ </IntlayerProvider>
91
+ <IntlayerServerProvider locale={locale}>
92
+ <ServerComponentExample />
93
+ </IntlayerServerProvider>
94
+ </>
95
+ );
96
+ };
97
+ ```
98
+
99
+ ```jsx fileName="src/app.jsx" codeFormat="esm"
100
+ import { ClientComponentExample, ServerComponentExample } from "@components";
101
+ import { IntlayerProvider } from "react-intlayer";
102
+ import { IntlayerServerProvider, useI18n } from "react-intlayer/server";
103
+
104
+ const App = ({ locale }) => {
105
+ const t = useI18n("home-page", locale);
106
+
107
+ return (
108
+ <>
109
+ <p>{t("introduction")}</p>
110
+ <IntlayerProvider locale={locale}>
111
+ <ClientComponentExample />
112
+ </IntlayerProvider>
113
+ <IntlayerServerProvider locale={locale}>
114
+ <ServerComponentExample />
115
+ </IntlayerServerProvider>
116
+ </>
117
+ );
118
+ };
119
+ ```
120
+
121
+ ```jsx fileName="src/app.cjs" codeFormat="commonjs"
122
+ const { IntlayerProvider } = require("react-intlayer");
123
+ const { IntlayerServerProvider, useI18n } = require("react-intlayer/server");
124
+
125
+ const App = ({ locale }) => {
126
+ const t = useI18n("home-page", locale);
127
+
128
+ return (
129
+ <>
130
+ <p>{t("introduction")}</p>
131
+ <IntlayerProvider locale={locale}>
132
+ <ClientComponentExample />
133
+ </IntlayerProvider>
134
+ <IntlayerServerProvider locale={locale}>
135
+ <ServerComponentExample />
136
+ </IntlayerServerProvider>
137
+ </>
138
+ );
139
+ };
140
+ <ServerComponentExample />
141
+ </IntlayerServerProvider>
142
+ </>
143
+ );
144
+ };
145
+ ```
146
+
147
+ ```tsx fileName="src/components/ComponentExample.tsx" codeFormat="typescript"
148
+ import type { FC } from "react";
149
+ import { useI18n } from "react-intlayer";
150
+
151
+ const ComponentExample: FC = () => {
152
+ const t = useI18n("component-example");
153
+
154
+ return (
155
+ <div>
156
+ <h1>{t("title")}</h1> {/* शीर्षक दिखाएं */}
157
+ <p>{t("description")}</p> {/* विवरण दिखाएं */}
158
+ </div>
159
+ );
160
+ };
161
+ ```
162
+
163
+ ```jsx fileName="src/components/ComponentExample.jsx" codeFormat="esm"
164
+ import { useI18n } from "react-intlayer";
165
+
166
+ const ComponentExample = () => {
167
+ const t = useI18n("component-example");
168
+
169
+ return (
170
+ <div>
171
+ <h1>{t("title")}</h1> {/* शीर्षक दिखाएं */}
172
+ <p>{t("description")}</p> {/* विवरण दिखाएं */}
173
+ </div>
174
+ );
175
+ };
176
+ ```
177
+
178
+ ```jsx fileName="src/components/ComponentExample.cjs" codeFormat="commonjs"
179
+ const { useI18n } = require("react-intlayer");
180
+
181
+ const ComponentExample = () => {
182
+ const t = useI18n("component-example");
183
+
184
+ return (
185
+ <div>
186
+ <h1>{t("title")}</h1> {/* शीर्षक दिखाएं */}
187
+ <p>{t("description")}</p> {/* विवरण दिखाएं */}
188
+ </div>
189
+ );
190
+ };
191
+ ```
192
+
193
+ ```tsx fileName="src/components/ServerComponentExample.tsx" codeFormat="typescript"
194
+ import { useI18n } from "react-intlayer/server";
195
+
196
+ const ServerComponentExample = () => {
197
+ const t = useI18n("server-component");
198
+
199
+ return (
200
+ <div>
201
+ <h1>{t("title")}</h1> {/* शीर्षक दिखाएं */}
202
+ <p>{t("description")}</p> {/* विवरण दिखाएं */}
203
+ </div>
204
+ );
205
+ };
206
+ ```
207
+
208
+ ```jsx fileName="src/components/ServerComponentExample.jsx" codeFormat="esm"
209
+ import { useI18n } from "react-intlayer/server";
210
+
211
+ const ServerComponentExample = () => {
212
+ const t = useI18n("server-component");
213
+
214
+ return (
215
+ <div>
216
+ <h1>{t("title")}</h1> {/* शीर्षक दिखाएं */}
217
+ <p>{t("description")}</p> {/* विवरण दिखाएं */}
218
+ </div>
219
+ );
220
+ };
221
+ ```
222
+
223
+ ```jsx fileName="src/components/ServerComponentExample.cjs" codeFormat="commonjs"
224
+ const { useI18n } = require("react-intlayer/server");
225
+
226
+ const ServerComponentExample = () => {
227
+ const t = useI18n("server-component");
228
+
229
+ return (
230
+ <div>
231
+ <h1>{t("title")}</h1>
232
+ <p>{t("description")}</p>
233
+ </div>
234
+ );
235
+ };
236
+ ```
237
+
238
+ ## एट्रिब्यूट हैंडलिंग
239
+
240
+ जब एट्रिब्यूट्स का स्थानीयकरण किया जाता है, तो अनुवाद मानों तक उचित रूप से पहुँचें:
241
+
242
+ ```jsx
243
+ <button title={t("buttonTitle.value")}>{t("buttonText")}</button>;
244
+
245
+ {
246
+ /* पहुँच योग्यता एट्रिब्यूट्स (जैसे, aria-label) के लिए, .value का उपयोग करें क्योंकि शुद्ध स्ट्रिंग्स आवश्यक हैं */
247
+ }
248
+ <button aria-label={t("button.ariaLabel").value}>{t("button.text")}</button>;
249
+ ```
250
+
251
+ ## अतिरिक्त संसाधन
252
+
253
+ - **Intlayer विज़ुअल एडिटर**: एक अधिक सहज सामग्री प्रबंधन अनुभव के लिए, विज़ुअल एडिटर दस्तावेज़ीकरण [यहाँ](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_visual_editor.md) देखें।
254
+
255
+ यह अनुभाग विशेष रूप से React अनुप्रयोगों में `useI18n` हुक के एकीकरण को कवर करता है, जो स्थानीयकरण प्रक्रिया को सरल बनाता है और विभिन्न स्थानीयताओं में सामग्री की संगति सुनिश्चित करता है।
256
+
257
+ ## प्रलेखन इतिहास
258
+
259
+ - 6.0.0 - 2025-06-29: `useI18n` हुक प्रलेखन की प्रारंभिक लेखन
@@ -268,10 +268,12 @@ Impostazioni che controllano il comportamento del middleware, inclusa la gestion
268
268
  - **prefixDefault**:
269
269
 
270
270
  - _Tipo_: `boolean`
271
- - _Predefinito_: `true`
271
+ - _Predefinito_: `false`
272
272
  - _Descrizione_: Indica se includere il locale predefinito nell'URL.
273
- - _Esempio_: `false`
274
- - _Nota_: Se `false`, gli URL per la lingua predefinita non avranno un prefisso di lingua.
273
+ - _Esempio_: `true`
274
+ - _Nota_:
275
+ - Se `true` e `defaultLocale = 'en'`: path = `/en/dashboard` o `/fr/dashboard`
276
+ - Se `false` e `defaultLocale = 'en'`: path = `/dashboard` o `/fr/dashboard`
275
277
 
276
278
  - **basePath**:
277
279
 
@@ -279,7 +281,11 @@ Impostazioni che controllano il comportamento del middleware, inclusa la gestion
279
281
  - _Predefinito_: `''`
280
282
  - _Descrizione_: Il percorso base per gli URL dell'applicazione.
281
283
  - _Esempio_: `'/my-app'`
282
- - _Nota_: Questo influisce su come vengono costruiti gli URL per l'applicazione.
284
+ - _Nota_:
285
+ - Se l'applicazione è ospitata su `https://example.com/my-app`
286
+ - Il percorso base è `'/my-app'`
287
+ - L'URL sarà `https://example.com/my-app/en`
288
+ - Se il percorso base non è impostato, l'URL sarà `https://example.com/en`
283
289
 
284
290
  - **serverSetCookie**:
285
291
 
@@ -291,11 +297,42 @@ Impostazioni che controllano il comportamento del middleware, inclusa la gestion
291
297
  - _Nota_: Controlla se il cookie della lingua viene impostato su ogni richiesta o mai.
292
298
 
293
299
  - **noPrefix**:
300
+
294
301
  - _Tipo_: `boolean`
295
302
  - _Predefinito_: `false`
296
303
  - _Descrizione_: Indica se omettere il prefisso della lingua dagli URL.
297
304
  - _Esempio_: `true`
298
- - _Nota_: Se `true`, gli URL non conterranno informazioni sulla lingua.
305
+ - _Nota_:
306
+ - Se `true`: Nessun prefisso nell'URL
307
+ - Se `false`: Prefisso nell'URL
308
+ - Esempio con `basePath = '/my-app'`:
309
+ - Se `noPrefix = false`: L'URL sarà `https://example.com/my-app/en`
310
+ - Se `noPrefix = true`: L'URL sarà `https://example.com`
311
+
312
+ - **detectLocaleOnPrefetchNoPrefix**:
313
+
314
+ - _Tipo_: `boolean`
315
+ - _Predefinito_: `false`
316
+ - _Descrizione_: Controlla se la rilevazione del locale avviene durante le richieste di prefetch di Next.js.
317
+ - _Esempio_: `true`
318
+ - _Nota_: Questa impostazione influisce su come Next.js gestisce il prefetch del locale:
319
+ - **Scenario di esempio:**
320
+ - La lingua del browser dell'utente è `'fr'`
321
+ - La pagina corrente è `/fr/about`
322
+ - Il link fa prefetch di `/about`
323
+ - **Con `detectLocaleOnPrefetchNoPrefix: true`:**
324
+ - Il prefetch rileva il locale `'fr'` dal browser
325
+ - Reindirizza il prefetch a `/fr/about`
326
+ - **Con `detectLocaleOnPrefetchNoPrefix: false` (predefinito):**
327
+ - Il prefetch usa il locale predefinito
328
+ - Reindirizza il prefetch a `/en/about` (assumendo che `'en'` sia il predefinito)
329
+ - **Quando usare `true`:**
330
+ - La tua app usa link interni non localizzati (es. `<a href="/about">`)
331
+ - Vuoi un comportamento di rilevazione del locale coerente tra richieste normali e di prefetch
332
+ - **Quando usare `false` (predefinito):**
333
+ - La tua app usa link con prefisso del locale (es. `<a href="/fr/about">`)
334
+ - Vuoi ottimizzare le prestazioni del prefetch
335
+ - Vuoi evitare potenziali loop di reindirizzamento
299
336
 
300
337
  ---
301
338
 
@@ -15,7 +15,6 @@ slugs:
15
15
  - doc
16
16
  - concept
17
17
  - content
18
- - it
19
18
  - enumeration
20
19
  ---
21
20