@intlayer/docs 7.3.14 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/intlayer_with_i18next.md +3 -0
- package/blog/ar/intlayer_with_next-i18next.md +3 -0
- package/blog/ar/intlayer_with_next-intl.md +3 -0
- package/blog/ar/intlayer_with_react-i18next.md +3 -0
- package/blog/ar/intlayer_with_react-intl.md +3 -0
- package/blog/ar/intlayer_with_vue-i18n.md +3 -0
- package/blog/de/intlayer_with_i18next.md +3 -0
- package/blog/de/intlayer_with_next-i18next.md +3 -0
- package/blog/de/intlayer_with_next-intl.md +3 -0
- package/blog/de/intlayer_with_react-i18next.md +3 -0
- package/blog/de/intlayer_with_react-intl.md +3 -0
- package/blog/de/intlayer_with_vue-i18n.md +3 -0
- package/blog/en/intlayer_with_i18next.md +7 -0
- package/blog/en/intlayer_with_next-i18next.md +3 -0
- package/blog/en/intlayer_with_next-intl.md +7 -0
- package/blog/en/intlayer_with_react-i18next.md +3 -0
- package/blog/en/intlayer_with_react-intl.md +3 -0
- package/blog/en/intlayer_with_vue-i18n.md +3 -0
- package/blog/en-GB/intlayer_with_i18next.md +3 -0
- package/blog/en-GB/intlayer_with_next-i18next.md +3 -0
- package/blog/en-GB/intlayer_with_next-intl.md +3 -0
- package/blog/en-GB/intlayer_with_react-i18next.md +3 -0
- package/blog/en-GB/intlayer_with_react-intl.md +3 -0
- package/blog/en-GB/intlayer_with_vue-i18n.md +3 -0
- package/blog/es/intlayer_with_i18next.md +3 -0
- package/blog/es/intlayer_with_next-i18next.md +3 -0
- package/blog/es/intlayer_with_next-intl.md +3 -0
- package/blog/es/intlayer_with_react-i18next.md +3 -0
- package/blog/es/intlayer_with_react-intl.md +3 -0
- package/blog/es/intlayer_with_vue-i18n.md +3 -0
- package/blog/fr/intlayer_with_i18next.md +3 -0
- package/blog/fr/intlayer_with_next-i18next.md +3 -0
- package/blog/fr/intlayer_with_next-intl.md +3 -0
- package/blog/fr/intlayer_with_react-i18next.md +3 -0
- package/blog/fr/intlayer_with_react-intl.md +3 -0
- package/blog/fr/intlayer_with_vue-i18n.md +3 -0
- package/blog/hi/intlayer_with_i18next.md +3 -0
- package/blog/hi/intlayer_with_next-i18next.md +3 -0
- package/blog/hi/intlayer_with_next-intl.md +3 -0
- package/blog/hi/intlayer_with_react-i18next.md +3 -0
- package/blog/hi/intlayer_with_react-intl.md +3 -0
- package/blog/hi/intlayer_with_vue-i18n.md +3 -0
- package/blog/id/intlayer_with_i18next.md +3 -0
- package/blog/id/intlayer_with_next-i18next.md +3 -0
- package/blog/id/intlayer_with_next-intl.md +3 -0
- package/blog/id/intlayer_with_react-i18next.md +3 -0
- package/blog/id/intlayer_with_react-intl.md +3 -0
- package/blog/id/intlayer_with_vue-i18n.md +3 -0
- package/blog/it/intlayer_with_i18next.md +3 -0
- package/blog/it/intlayer_with_next-i18next.md +3 -0
- package/blog/it/intlayer_with_next-intl.md +3 -0
- package/blog/it/intlayer_with_react-i18next.md +3 -0
- package/blog/it/intlayer_with_react-intl.md +3 -0
- package/blog/it/intlayer_with_vue-i18n.md +3 -0
- package/blog/ja/intlayer_with_i18next.md +3 -0
- package/blog/ja/intlayer_with_next-i18next.md +3 -0
- package/blog/ja/intlayer_with_next-intl.md +3 -0
- package/blog/ja/intlayer_with_react-i18next.md +3 -0
- package/blog/ja/intlayer_with_react-intl.md +3 -0
- package/blog/ja/intlayer_with_vue-i18n.md +3 -0
- package/blog/ko/intlayer_with_i18next.md +3 -0
- package/blog/ko/intlayer_with_next-i18next.md +3 -0
- package/blog/ko/intlayer_with_next-intl.md +3 -0
- package/blog/ko/intlayer_with_react-i18next.md +3 -0
- package/blog/ko/intlayer_with_react-intl.md +3 -0
- package/blog/ko/intlayer_with_vue-i18n.md +3 -0
- package/blog/pl/intlayer_with_i18next.md +3 -0
- package/blog/pl/intlayer_with_next-i18next.md +3 -0
- package/blog/pl/intlayer_with_next-intl.md +3 -0
- package/blog/pl/intlayer_with_react-i18next.md +3 -0
- package/blog/pl/intlayer_with_react-intl.md +3 -0
- package/blog/pl/intlayer_with_vue-i18n.md +3 -0
- package/blog/pt/intlayer_with_i18next.md +3 -0
- package/blog/pt/intlayer_with_next-i18next.md +3 -0
- package/blog/pt/intlayer_with_next-intl.md +3 -0
- package/blog/pt/intlayer_with_react-i18next.md +3 -0
- package/blog/pt/intlayer_with_react-intl.md +3 -0
- package/blog/pt/intlayer_with_vue-i18n.md +3 -0
- package/blog/ru/intlayer_with_i18next.md +3 -0
- package/blog/ru/intlayer_with_next-i18next.md +3 -0
- package/blog/ru/intlayer_with_next-intl.md +3 -0
- package/blog/ru/intlayer_with_react-i18next.md +3 -0
- package/blog/ru/intlayer_with_react-intl.md +3 -0
- package/blog/ru/intlayer_with_vue-i18n.md +3 -0
- package/blog/tr/intlayer_with_i18next.md +3 -0
- package/blog/tr/intlayer_with_next-i18next.md +3 -0
- package/blog/tr/intlayer_with_next-intl.md +3 -0
- package/blog/tr/intlayer_with_react-i18next.md +3 -0
- package/blog/tr/intlayer_with_vue-i18n.md +3 -0
- package/blog/vi/intlayer_with_i18next.md +3 -0
- package/blog/vi/intlayer_with_next-i18next.md +3 -0
- package/blog/vi/intlayer_with_next-intl.md +3 -0
- package/blog/vi/intlayer_with_react-i18next.md +3 -0
- package/blog/vi/intlayer_with_react-intl.md +3 -0
- package/blog/vi/intlayer_with_vue-i18n.md +3 -0
- package/blog/zh/intlayer_with_i18next.md +3 -0
- package/blog/zh/intlayer_with_next-i18next.md +3 -0
- package/blog/zh/intlayer_with_next-intl.md +3 -0
- package/blog/zh/intlayer_with_react-i18next.md +3 -0
- package/blog/zh/intlayer_with_react-intl.md +3 -0
- package/blog/zh/intlayer_with_vue-i18n.md +3 -0
- package/docs/ar/intlayer_with_lynx+react.md +1 -1
- package/docs/ar/intlayer_with_tanstack.md +132 -2
- package/docs/ar/intlayer_with_vite+react.md +99 -331
- package/docs/ar/plugins/sync-json.md +3 -0
- package/docs/de/intlayer_with_lynx+react.md +1 -1
- package/docs/de/intlayer_with_tanstack.md +132 -2
- package/docs/de/intlayer_with_vite+react.md +116 -380
- package/docs/de/plugins/sync-json.md +3 -0
- package/docs/en/intlayer_with_tanstack.md +131 -1
- package/docs/en/intlayer_with_vite+react.md +6 -10
- package/docs/en/plugins/sync-json.md +3 -0
- package/docs/en-GB/intlayer_with_tanstack.md +131 -1
- package/docs/en-GB/intlayer_with_vite+react.md +62 -74
- package/docs/en-GB/plugins/sync-json.md +3 -0
- package/docs/es/intlayer_with_tanstack.md +132 -2
- package/docs/es/intlayer_with_vite+react.md +101 -333
- package/docs/es/plugins/sync-json.md +3 -0
- package/docs/fr/intlayer_with_tanstack.md +132 -2
- package/docs/fr/intlayer_with_vite+react.md +101 -357
- package/docs/fr/plugins/sync-json.md +3 -0
- package/docs/hi/intlayer_with_tanstack.md +132 -2
- package/docs/hi/intlayer_with_vite+react.md +120 -333
- package/docs/hi/plugins/sync-json.md +3 -0
- package/docs/id/intlayer_with_tanstack.md +132 -2
- package/docs/id/intlayer_with_vite+react.md +7 -13
- package/docs/id/plugins/sync-json.md +3 -0
- package/docs/it/intlayer_with_lynx+react.md +1 -1
- package/docs/it/intlayer_with_tanstack.md +132 -2
- package/docs/it/intlayer_with_vite+react.md +121 -393
- package/docs/it/plugins/sync-json.md +3 -0
- package/docs/ja/intlayer_with_tanstack.md +132 -2
- package/docs/ja/intlayer_with_vite+react.md +106 -378
- package/docs/ja/plugins/sync-json.md +3 -0
- package/docs/ko/intlayer_with_lynx+react.md +1 -1
- package/docs/ko/intlayer_with_tanstack.md +132 -2
- package/docs/ko/intlayer_with_vite+react.md +90 -322
- package/docs/ko/plugins/sync-json.md +3 -0
- package/docs/pl/intlayer_with_tanstack.md +132 -2
- package/docs/pl/intlayer_with_vite+react.md +25 -21
- package/docs/pl/plugins/sync-json.md +3 -0
- package/docs/pt/intlayer_with_tanstack.md +132 -2
- package/docs/pt/intlayer_with_vite+react.md +96 -328
- package/docs/pt/plugins/sync-json.md +3 -0
- package/docs/ru/intlayer_with_lynx+react.md +1 -1
- package/docs/ru/intlayer_with_tanstack.md +132 -2
- package/docs/ru/intlayer_with_vite+react.md +109 -362
- package/docs/ru/plugins/sync-json.md +3 -0
- package/docs/tr/intlayer_with_tanstack.md +132 -2
- package/docs/tr/intlayer_with_vite+react.md +132 -366
- package/docs/tr/plugins/sync-json.md +3 -0
- package/docs/vi/intlayer_with_tanstack.md +132 -2
- package/docs/vi/intlayer_with_vite+react.md +16 -19
- package/docs/vi/plugins/sync-json.md +3 -0
- package/docs/zh/intlayer_with_tanstack.md +133 -3
- package/docs/zh/intlayer_with_vite+react.md +91 -374
- package/docs/zh/plugins/sync-json.md +3 -0
- package/frequent_questions/ar/customized_locale_list.md +1 -1
- package/frequent_questions/de/customized_locale_list.md +1 -1
- package/frequent_questions/en/customized_locale_list.md +1 -1
- package/frequent_questions/en-GB/customized_locale_list.md +1 -1
- package/frequent_questions/es/customized_locale_list.md +1 -1
- package/frequent_questions/fr/customized_locale_list.md +1 -1
- package/frequent_questions/hi/customized_locale_list.md +1 -1
- package/frequent_questions/id/customized_locale_list.md +1 -1
- package/frequent_questions/it/customized_locale_list.md +1 -1
- package/frequent_questions/ja/customized_locale_list.md +1 -1
- package/frequent_questions/ko/customized_locale_list.md +1 -1
- package/frequent_questions/pl/customized_locale_list.md +1 -1
- package/frequent_questions/pt/customized_locale_list.md +1 -1
- package/frequent_questions/ru/customized_locale_list.md +1 -1
- package/frequent_questions/tr/customized_locale_list.md +1 -1
- package/frequent_questions/vi/customized_locale_list.md +1 -1
- package/frequent_questions/zh/customized_locale_list.md +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2024-03-07
|
|
3
|
-
updatedAt:
|
|
4
|
-
title: अपना Vite
|
|
3
|
+
updatedAt: 2025-12-10
|
|
4
|
+
title: अपना Vite और React एप्लिकेशन कैसे अनुवाद करें – i18n गाइड 2025
|
|
5
5
|
description: जानें कि कैसे Intlayer का उपयोग करके अपने Vite और React एप्लिकेशन में अंतरराष्ट्रीयकरण (i18n) जोड़ें। इस गाइड का पालन करके अपनी ऐप को बहुभाषी बनाएं।
|
|
6
6
|
keywords:
|
|
7
7
|
- अंतरराष्ट्रीयकरण
|
|
@@ -16,23 +16,19 @@ slugs:
|
|
|
16
16
|
- environment
|
|
17
17
|
- vite-and-react
|
|
18
18
|
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
19
|
-
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
20
20
|
history:
|
|
21
21
|
- version: 5.5.10
|
|
22
22
|
date: 2025-06-29
|
|
23
|
-
changes:
|
|
23
|
+
changes: Init history
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
# Intlayer
|
|
26
|
+
# Intlayer का उपयोग करके अपनी Vite और React वेबसाइट का अनुवाद करें | अंतरराष्ट्रीयकरण (i18n)
|
|
27
27
|
|
|
28
28
|
## विषय-सूची
|
|
29
29
|
|
|
30
30
|
<TOC/>
|
|
31
31
|
|
|
32
|
-
<iframe title="The best i18n solution for Vite and React? Discover Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?si=VaKmrYMmXjo3xpk2"/>
|
|
33
|
-
|
|
34
|
-
GitHub पर [एप्लिकेशन टेम्पलेट](https://github.com/aymericzip/intlayer-vite-react-template) देखें।
|
|
35
|
-
|
|
36
32
|
## Intlayer क्या है?
|
|
37
33
|
|
|
38
34
|
**Intlayer** एक अभिनव, ओपन-सोर्स अंतरराष्ट्रीयकरण (i18n) लाइब्रेरी है जिसे आधुनिक वेब एप्लिकेशन में बहुभाषी समर्थन को सरल बनाने के लिए डिज़ाइन किया गया है।
|
|
@@ -48,6 +44,27 @@ Intlayer के साथ, आप कर सकते हैं:
|
|
|
48
44
|
|
|
49
45
|
## Vite और React एप्लिकेशन में Intlayer सेटअप करने के लिए चरण-दर-चरण मार्गदर्शिका
|
|
50
46
|
|
|
47
|
+
<Tab defaultTab="video">
|
|
48
|
+
<TabItem label="Video" value="video">
|
|
49
|
+
|
|
50
|
+
<iframe title="The best i18n solution for Vite and React? Discover Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?si=VaKmrYMmXjo3xpk2"/>
|
|
51
|
+
|
|
52
|
+
</TabItem>
|
|
53
|
+
<TabItem label="Code" value="code">
|
|
54
|
+
|
|
55
|
+
<iframe
|
|
56
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-react-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
57
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
58
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
59
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
60
|
+
loading="lazy"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
</TabItem>
|
|
64
|
+
</Tab>
|
|
65
|
+
|
|
66
|
+
GitHub पर [एप्लिकेशन टेम्पलेट](https://github.com/aymericzip/intlayer-vite-react-template) देखें।
|
|
67
|
+
|
|
51
68
|
### चरण 1: निर्भरताएँ स्थापित करें
|
|
52
69
|
|
|
53
70
|
npm का उपयोग करके आवश्यक पैकेज स्थापित करें:
|
|
@@ -68,8 +85,7 @@ yarn add vite-intlayer --save-dev
|
|
|
68
85
|
```
|
|
69
86
|
|
|
70
87
|
- **intlayer**
|
|
71
|
-
|
|
72
|
-
मुख्य पैकेज जो कॉन्फ़िगरेशन प्रबंधन, अनुवाद, [सामग्री घोषणा](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/get_started.md), ट्रांसपाइलेशन, और [CLI कमांड्स](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_cli.md) के लिए अंतरराष्ट्रीयकरण उपकरण प्रदान करता है।
|
|
88
|
+
यह मुख्य पैकेज है जो कॉन्फ़िगरेशन प्रबंधन, अनुवाद, [सामग्री घोषणा](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/content_file.md), ट्रांसपाइलेशन, और [CLI कमांड्स](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/cli/index.md) के लिए अंतरराष्ट्रीयकरण उपकरण प्रदान करता है।
|
|
73
89
|
|
|
74
90
|
- **react-intlayer**
|
|
75
91
|
वह पैकेज जो Intlayer को React एप्लिकेशन के साथ एकीकृत करता है। यह React अंतरराष्ट्रीयकरण के लिए संदर्भ प्रदाता और हुक्स प्रदान करता है।
|
|
@@ -176,7 +192,7 @@ module.exports = defineConfig({
|
|
|
176
192
|
});
|
|
177
193
|
```
|
|
178
194
|
|
|
179
|
-
|
|
195
|
+
`intlayer()` Vite प्लगइन का उपयोग Intlayer को Vite के साथ एकीकृत करने के लिए किया जाता है। यह कंटेंट घोषणा फ़ाइलों के निर्माण को सुनिश्चित करता है और विकास मोड में उनकी निगरानी करता है। यह Vite एप्लिकेशन के भीतर Intlayer पर्यावरण चर को परिभाषित करता है। इसके अतिरिक्त, यह प्रदर्शन को अनुकूलित करने के लिए उपनाम प्रदान करता है।
|
|
180
196
|
|
|
181
197
|
### चरण 4: अपनी सामग्री घोषित करें
|
|
182
198
|
|
|
@@ -193,11 +209,13 @@ const appContent = {
|
|
|
193
209
|
en: "Vite logo",
|
|
194
210
|
fr: "Logo Vite",
|
|
195
211
|
es: "Logo Vite",
|
|
212
|
+
hi: "Vite लोगो",
|
|
196
213
|
}),
|
|
197
214
|
reactLogo: t({
|
|
198
215
|
en: "React logo",
|
|
199
216
|
fr: "Logo React",
|
|
200
217
|
es: "Logo React",
|
|
218
|
+
hi: "React लोगो",
|
|
201
219
|
}),
|
|
202
220
|
|
|
203
221
|
title: "Vite + React",
|
|
@@ -206,13 +224,13 @@ const appContent = {
|
|
|
206
224
|
en: "count is ",
|
|
207
225
|
fr: "le compte est ",
|
|
208
226
|
es: "el recuento es ",
|
|
227
|
+
hi: "गिनती है ",
|
|
209
228
|
}),
|
|
210
229
|
|
|
211
230
|
edit: t<ReactNode>({
|
|
212
231
|
en: (
|
|
213
232
|
<>
|
|
214
|
-
<code>src/App.tsx</code>
|
|
215
|
-
सहेजें
|
|
233
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
216
234
|
</>
|
|
217
235
|
),
|
|
218
236
|
fr: (
|
|
@@ -225,12 +243,19 @@ const appContent = {
|
|
|
225
243
|
Edita <code>src/App.tsx</code> y guarda para probar HMR
|
|
226
244
|
</>
|
|
227
245
|
),
|
|
246
|
+
hi: (
|
|
247
|
+
<>
|
|
248
|
+
<code>src/App.tsx</code> को संपादित करें और HMR का परीक्षण करने के लिए
|
|
249
|
+
सहेजें
|
|
250
|
+
</>
|
|
251
|
+
),
|
|
228
252
|
}),
|
|
229
253
|
|
|
230
254
|
readTheDocs: t({
|
|
231
255
|
en: "Click on the Vite and React logos to learn more",
|
|
232
256
|
fr: "Cliquez sur les logos Vite et React pour en savoir plus",
|
|
233
257
|
es: "Haga clic en los logotipos de Vite y React para obtener más información",
|
|
258
|
+
hi: "अधिक जानने के लिए Vite और React लोगो पर क्लिक करें",
|
|
234
259
|
}),
|
|
235
260
|
},
|
|
236
261
|
} satisfies Dictionary;
|
|
@@ -308,11 +333,13 @@ const appContent = {
|
|
|
308
333
|
en: "Vite logo",
|
|
309
334
|
fr: "Logo Vite",
|
|
310
335
|
es: "Logo Vite",
|
|
336
|
+
hi: "Vite लोगो",
|
|
311
337
|
}),
|
|
312
338
|
reactLogo: t({
|
|
313
339
|
en: "React logo",
|
|
314
340
|
fr: "Logo React",
|
|
315
341
|
es: "Logo React",
|
|
342
|
+
hi: "React लोगो",
|
|
316
343
|
}),
|
|
317
344
|
|
|
318
345
|
title: "Vite + React",
|
|
@@ -321,6 +348,7 @@ const appContent = {
|
|
|
321
348
|
en: "count is ",
|
|
322
349
|
fr: "le compte est ",
|
|
323
350
|
es: "el recuento es ",
|
|
351
|
+
hi: "काउंट है ",
|
|
324
352
|
}),
|
|
325
353
|
|
|
326
354
|
edit:
|
|
@@ -330,7 +358,7 @@ const appContent = {
|
|
|
330
358
|
// यदि आप अपनी सामग्री में React node का उपयोग करते हैं तो React को import करना न भूलें
|
|
331
359
|
en: (
|
|
332
360
|
<>
|
|
333
|
-
Edit <code>src/App.tsx</code>
|
|
361
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
334
362
|
</>
|
|
335
363
|
),
|
|
336
364
|
fr: (
|
|
@@ -340,7 +368,12 @@ const appContent = {
|
|
|
340
368
|
),
|
|
341
369
|
es: (
|
|
342
370
|
<>
|
|
343
|
-
Edita <code>src/App.tsx</code>
|
|
371
|
+
Edita <code>src/App.tsx</code> y guarda para probar HMR
|
|
372
|
+
</>
|
|
373
|
+
),
|
|
374
|
+
hi: (
|
|
375
|
+
<>
|
|
376
|
+
<code>src/App.tsx</code> संपादित करें और HMR परीक्षण के लिए सहेजें
|
|
344
377
|
</>
|
|
345
378
|
),
|
|
346
379
|
},
|
|
@@ -410,6 +443,9 @@ module.exports = appContent;
|
|
|
410
443
|
"readTheDocs": {
|
|
411
444
|
"nodeType": "translation",
|
|
412
445
|
"translation": {
|
|
446
|
+
"en": "Click on the Vite and React logos to learn more",
|
|
447
|
+
"fr": "Cliquez sur les logos Vite et React pour en savoir plus",
|
|
448
|
+
"es": "Haga clic en los logotipos de Vite y React para obtener más información",
|
|
413
449
|
"hi": "अधिक जानने के लिए Vite और React लोगो पर क्लिक करें"
|
|
414
450
|
}
|
|
415
451
|
}
|
|
@@ -417,11 +453,11 @@ module.exports = appContent;
|
|
|
417
453
|
}
|
|
418
454
|
```
|
|
419
455
|
|
|
420
|
-
> आपकी सामग्री घोषणाएँ आपके एप्लिकेशन में कहीं भी परिभाषित की जा सकती हैं जब वे `contentDir` निर्देशिका (डिफ़ॉल्ट रूप से, `./src`) में शामिल हो जाती
|
|
456
|
+
> आपकी सामग्री घोषणाएँ आपके एप्लिकेशन में कहीं भी परिभाषित की जा सकती हैं जब वे `contentDir` निर्देशिका (डिफ़ॉल्ट रूप से, `./src`) में शामिल हो जाती हैं और सामग्री घोषणा फ़ाइल एक्सटेंशन से मेल खाती हैं (डिफ़ॉल्ट रूप से, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`)।
|
|
421
457
|
|
|
422
|
-
> अधिक विवरण के लिए, [सामग्री घोषणा प्रलेखन](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/
|
|
458
|
+
> अधिक विवरण के लिए, [सामग्री घोषणा प्रलेखन](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/content_file.md) देखें।
|
|
423
459
|
|
|
424
|
-
|
|
460
|
+
यदि आपकी सामग्री फ़ाइल में TSX कोड शामिल है, तो आपको अपनी सामग्री फ़ाइल में `import React from "react";` आयात करने पर विचार करना चाहिए।
|
|
425
461
|
|
|
426
462
|
### चरण 5: अपने कोड में Intlayer का उपयोग करें
|
|
427
463
|
|
|
@@ -639,345 +675,98 @@ const LocaleSwitcher = () => {
|
|
|
639
675
|
- https://example.com/fr/about
|
|
640
676
|
```
|
|
641
677
|
|
|
642
|
-
|
|
678
|
+
डिफ़ॉल्ट रूप से, डिफ़ॉल्ट लोकल के लिए रूट्स को कोई प्रीफ़िक्स नहीं दिया जाता है। यदि आप डिफ़ॉल्ट लोकल के लिए प्रीफ़िक्स जोड़ना चाहते हैं, तो आप अपनी कॉन्फ़िगरेशन में `middleware.prefixDefault` विकल्प को `true` पर सेट कर सकते हैं। अधिक जानकारी के लिए [कॉन्फ़िगरेशन दस्तावेज़](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/configuration.md) देखें।
|
|
643
679
|
|
|
644
680
|
अपने एप्लिकेशन में स्थानीयकृत रूटिंग जोड़ने के लिए, आप एक `LocaleRouter` कॉम्पोनेंट बना सकते हैं जो आपके एप्लिकेशन के रूट्स को लपेटता है और लोकल-आधारित रूटिंग को संभालता है। यहाँ [React Router](https://reactrouter.com/home) का उपयोग करते हुए एक उदाहरण दिया गया है:
|
|
645
681
|
|
|
646
682
|
```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
|
|
647
|
-
//
|
|
648
|
-
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // 'intlayer' से उपयोगिता फ़ंक्शन और प्रकार
|
|
683
|
+
import { localeMap } from "intlayer"; // 'intlayer' से उपयोगिता फ़ंक्शन और प्रकार
|
|
649
684
|
import type { FC, PropsWithChildren } from "react"; // कार्यात्मक घटकों और प्रॉप्स के लिए React प्रकार
|
|
650
685
|
import { IntlayerProvider } from "react-intlayer"; // अंतरराष्ट्रीयकरण संदर्भ के लिए प्रदाता
|
|
651
|
-
import {
|
|
652
|
-
BrowserRouter,
|
|
653
|
-
Routes,
|
|
654
|
-
Route,
|
|
655
|
-
Navigate,
|
|
656
|
-
useLocation,
|
|
657
|
-
} from "react-router-dom"; // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
658
|
-
|
|
659
|
-
// Intlayer से कॉन्फ़िगरेशन को डीस्ट्रक्चर करना
|
|
660
|
-
const { internationalization, middleware } = configuration;
|
|
661
|
-
const { locales, defaultLocale } = internationalization;
|
|
686
|
+
import { BrowserRouter, Route, Routes } from "react-router-dom"; // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
662
687
|
|
|
663
688
|
/**
|
|
664
|
-
* एक घटक जो
|
|
665
|
-
* यह URL-आधारित लोकल पहचान और सत्यापन का प्रबंधन करता है।
|
|
666
|
-
*/
|
|
667
|
-
const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
668
|
-
children,
|
|
669
|
-
locale,
|
|
670
|
-
}) => {
|
|
671
|
-
const { pathname, search } = useLocation(); // वर्तमान URL पथ प्राप्त करें
|
|
672
|
-
|
|
673
|
-
// वर्तमान लोकल निर्धारित करें, यदि प्रदान नहीं किया गया है तो डिफ़ॉल्ट पर वापस जाएं
|
|
674
|
-
const currentLocale = locale ?? defaultLocale;
|
|
675
|
-
|
|
676
|
-
// पथ से लोकल उपसर्ग हटाएं ताकि एक बेस पथ बनाया जा सके
|
|
677
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
678
|
-
pathname // वर्तमान URL पथ
|
|
679
|
-
);
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* यदि middleware.prefixDefault सत्य है, तो डिफ़ॉल्ट लोकल हमेशा उपसर्गित होना चाहिए।
|
|
683
|
-
*/
|
|
684
|
-
if (middleware.prefixDefault) {
|
|
685
|
-
// लोकल को मान्य करें
|
|
686
|
-
if (!locale || !locales.includes(locale)) {
|
|
687
|
-
// अपडेट किए गए पथ के साथ डिफ़ॉल्ट लोकल पर पुनर्निर्देशित करें
|
|
688
|
-
return (
|
|
689
|
-
<Navigate
|
|
690
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
691
|
-
replace // वर्तमान इतिहास प्रविष्टि को नए से बदलें
|
|
692
|
-
/>
|
|
693
|
-
);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान लोकल सेट करें
|
|
697
|
-
return (
|
|
698
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
699
|
-
);
|
|
700
|
-
} else {
|
|
701
|
-
/**
|
|
702
|
-
* जब middleware.prefixDefault गलत होता है, तो डिफ़ॉल्ट लोकल उपसर्गित नहीं होता है।
|
|
703
|
-
* सुनिश्चित करें कि वर्तमान लोकल मान्य है और डिफ़ॉल्ट लोकल नहीं है।
|
|
704
|
-
*/
|
|
705
|
-
if (
|
|
706
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
707
|
-
!locales
|
|
708
|
-
.filter(
|
|
709
|
-
(locale) => locale.toString() !== defaultLocale.toString() // डिफ़ॉल्ट लोकल को बाहर करें
|
|
710
|
-
)
|
|
711
|
-
.includes(currentLocale) // जांचें कि वर्तमान लोकल मान्य लोकलों की सूची में है या नहीं
|
|
712
|
-
) {
|
|
713
|
-
// लोकल उपसर्ग के बिना पथ पर पुनर्निर्देशित करें
|
|
714
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान लोकल सेट करें
|
|
718
|
-
return (
|
|
719
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
720
|
-
);
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* एक राउटर घटक जो लोकल-विशिष्ट मार्ग सेट करता है।
|
|
689
|
+
* एक राउटर घटक जो स्थानीय-विशिष्ट मार्ग सेट करता है।
|
|
726
690
|
* यह React Router का उपयोग नेविगेशन प्रबंधित करने और स्थानीयकृत घटकों को रेंडर करने के लिए करता है।
|
|
727
691
|
*/
|
|
728
692
|
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
729
693
|
<BrowserRouter>
|
|
730
694
|
<Routes>
|
|
731
|
-
{
|
|
732
|
-
|
|
733
|
-
(
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
/>
|
|
742
|
-
))}
|
|
743
|
-
|
|
744
|
-
{
|
|
745
|
-
// यदि डिफ़ॉल्ट लोकल का उपसर्ग निष्क्रिय है, तो बच्चों को सीधे रूट पथ पर रेंडर करें
|
|
746
|
-
!middleware.prefixDefault && (
|
|
747
|
-
<Route
|
|
748
|
-
path="*"
|
|
749
|
-
element={
|
|
750
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
751
|
-
} // बच्चों को लोकल प्रबंधन के साथ लपेटता है
|
|
752
|
-
/>
|
|
753
|
-
)
|
|
754
|
-
}
|
|
695
|
+
{localeMap(({ locale, urlPrefix }) => (
|
|
696
|
+
<Route
|
|
697
|
+
// लोकल को पकड़ने के लिए रूट पैटर्न (उदाहरण: /en/, /fr/) और सभी बाद के पथों से मेल खाना
|
|
698
|
+
path={`${urlPrefix}/*`}
|
|
699
|
+
key={locale}
|
|
700
|
+
element={
|
|
701
|
+
<IntlayerProvider locale={locale}>{children}</IntlayerProvider>
|
|
702
|
+
} // लोकल प्रबंधन के साथ बच्चों को लपेटें
|
|
703
|
+
/>
|
|
704
|
+
))}
|
|
755
705
|
</Routes>
|
|
756
706
|
</BrowserRouter>
|
|
757
707
|
);
|
|
758
708
|
```
|
|
759
709
|
|
|
760
710
|
```jsx fileName="src/components/LocaleRouter.mjx" codeFormat="esm"
|
|
761
|
-
//
|
|
762
|
-
import {
|
|
763
|
-
|
|
764
|
-
import {
|
|
765
|
-
import {
|
|
766
|
-
BrowserRouter,
|
|
767
|
-
Routes,
|
|
768
|
-
Route,
|
|
769
|
-
Navigate,
|
|
770
|
-
useLocation,
|
|
771
|
-
} from "react-router-dom"; // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
772
|
-
|
|
773
|
-
// Intlayer से विन्यास को डीस्ट्रक्चर करना
|
|
774
|
-
const { internationalization, middleware } = configuration;
|
|
775
|
-
const { locales, defaultLocale } = internationalization;
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* एक घटक जो स्थानीयकरण को संभालता है और बच्चों को उपयुक्त लोकल संदर्भ के साथ लपेटता है।
|
|
779
|
-
* यह URL-आधारित स्थानीयकरण पहचान और सत्यापन को प्रबंधित करता है।
|
|
780
|
-
*/
|
|
781
|
-
const AppLocalized = ({ children, locale }) => {
|
|
782
|
-
const { pathname, search } = useLocation(); // वर्तमान URL पथ प्राप्त करें
|
|
783
|
-
|
|
784
|
-
// वर्तमान स्थानीयकरण निर्धारित करें, यदि प्रदान नहीं किया गया है तो डिफ़ॉल्ट पर वापस जाएं
|
|
785
|
-
const currentLocale = locale ?? defaultLocale;
|
|
786
|
-
|
|
787
|
-
// पथ से स्थानीयकरण उपसर्ग हटाएं ताकि एक मूल पथ बनाया जा सके
|
|
788
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
789
|
-
pathname // वर्तमान URL पथ
|
|
790
|
-
);
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* यदि middleware.prefixDefault सत्य है, तो डिफ़ॉल्ट स्थानीयकरण हमेशा उपसर्गित होना चाहिए।
|
|
794
|
-
*/
|
|
795
|
-
if (middleware.prefixDefault) {
|
|
796
|
-
// स्थानीयकरण को सत्यापित करें
|
|
797
|
-
if (!locale || !locales.includes(locale)) {
|
|
798
|
-
// अद्यतन पथ के साथ डिफ़ॉल्ट स्थानीयकरण पर पुनर्निर्देशित करें
|
|
799
|
-
return (
|
|
800
|
-
<Navigate
|
|
801
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
802
|
-
replace // वर्तमान इतिहास प्रविष्टि को नए से बदलें
|
|
803
|
-
/>
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान स्थानीयकरण सेट करें
|
|
808
|
-
return (
|
|
809
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
810
|
-
);
|
|
811
|
-
} else {
|
|
812
|
-
/**
|
|
813
|
-
* जब middleware.prefixDefault गलत होता है, तो डिफ़ॉल्ट स्थानीयकरण उपसर्गित नहीं होता है।
|
|
814
|
-
* सुनिश्चित करें कि वर्तमान स्थानीयकरण मान्य है और डिफ़ॉल्ट स्थानीयकरण नहीं है।
|
|
815
|
-
*/
|
|
816
|
-
if (
|
|
817
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
818
|
-
!locales
|
|
819
|
-
.filter(
|
|
820
|
-
(locale) => locale.toString() !== defaultLocale.toString() // डिफ़ॉल्ट स्थानीयकरण को बाहर करें
|
|
821
|
-
)
|
|
822
|
-
.includes(currentLocale) // जांचें कि वर्तमान स्थानीयकरण मान्य स्थानीयकरणों की सूची में है या नहीं
|
|
823
|
-
) {
|
|
824
|
-
// स्थानीयकरण उपसर्ग के बिना पथ पर पुनर्निर्देशित करें
|
|
825
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान स्थानीयकरण सेट करें
|
|
829
|
-
return (
|
|
830
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
831
|
-
);
|
|
832
|
-
}
|
|
833
|
-
};
|
|
711
|
+
import { localeMap } from 'intlayer'; // 'intlayer' से उपयोगिता फ़ंक्शंस और प्रकार
|
|
712
|
+
import type { FC, PropsWithChildren } from 'react'; // फ़ंक्शनल कंपोनेंट्स और प्रॉप्स के लिए React प्रकार
|
|
713
|
+
import { IntlayerProvider } from 'react-intlayer'; // अंतर्राष्ट्रीयकरण संदर्भ के लिए प्रदाता
|
|
714
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom'; // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
834
715
|
|
|
835
716
|
/**
|
|
836
717
|
* एक राउटर घटक जो स्थानीयकरण-विशिष्ट मार्ग सेट करता है।
|
|
837
718
|
* यह React Router का उपयोग नेविगेशन प्रबंधित करने और स्थानीयकृत घटकों को रेंडर करने के लिए करता है।
|
|
838
719
|
*/
|
|
839
|
-
export const LocaleRouter = ({ children }) => (
|
|
720
|
+
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
840
721
|
<BrowserRouter>
|
|
841
722
|
<Routes>
|
|
842
|
-
{
|
|
843
|
-
|
|
844
|
-
(
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
/>
|
|
853
|
-
))}
|
|
854
|
-
|
|
855
|
-
{
|
|
856
|
-
// यदि डिफ़ॉल्ट स्थानीयकरण के लिए उपसर्ग अक्षम है, तो बच्चों को सीधे रूट पथ पर रेंडर करें
|
|
857
|
-
!middleware.prefixDefault && (
|
|
858
|
-
<Route
|
|
859
|
-
path="*"
|
|
860
|
-
element={
|
|
861
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
862
|
-
} // बच्चों को स्थानीयकरण प्रबंधन के साथ लपेटता है
|
|
863
|
-
/>
|
|
864
|
-
)
|
|
865
|
-
}
|
|
723
|
+
{localeMap(({ locale, urlPrefix }) => (
|
|
724
|
+
<Route
|
|
725
|
+
// स्थानीयकरण को पकड़ने के लिए रूट पैटर्न (जैसे, /en/, /fr/) और सभी बाद के पथों से मेल खाता है
|
|
726
|
+
path={`${urlPrefix}/*`}
|
|
727
|
+
key={locale}
|
|
728
|
+
element={
|
|
729
|
+
<IntlayerProvider locale={locale}>{children}</IntlayerProvider>
|
|
730
|
+
} // बच्चों को स्थानीयकरण प्रबंधन के साथ लपेटता है
|
|
731
|
+
/>
|
|
732
|
+
))}
|
|
866
733
|
</Routes>
|
|
867
734
|
</BrowserRouter>
|
|
868
735
|
);
|
|
869
736
|
```
|
|
870
737
|
|
|
871
738
|
```jsx fileName="src/components/LocaleRouter.cjx" codeFormat="commonjs"
|
|
872
|
-
//
|
|
873
|
-
const
|
|
874
|
-
const { IntlayerProvider
|
|
875
|
-
const {
|
|
876
|
-
BrowserRouter,
|
|
877
|
-
Routes,
|
|
878
|
-
Route,
|
|
879
|
-
Navigate,
|
|
880
|
-
useLocation,
|
|
881
|
-
} = require("react-router-dom"); // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
882
|
-
|
|
883
|
-
// Intlayer से विन्यास को डीस्ट्रक्चर करना
|
|
884
|
-
const { internationalization, middleware } = configuration;
|
|
885
|
-
const { locales, defaultLocale } = internationalization;
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* एक घटक जो स्थानीयकरण को संभालता है और बच्चों को उपयुक्त स्थानीय संदर्भ के साथ लपेटता है।
|
|
889
|
-
* यह URL-आधारित स्थानीय पहचान और सत्यापन का प्रबंधन करता है।
|
|
890
|
-
*/
|
|
891
|
-
const AppLocalized = ({ children, locale }) => {
|
|
892
|
-
const { pathname, search } = useLocation(); // वर्तमान URL पथ प्राप्त करें
|
|
893
|
-
|
|
894
|
-
// वर्तमान लोकल निर्धारित करें, यदि प्रदान नहीं किया गया है तो डिफ़ॉल्ट पर वापस जाएं
|
|
895
|
-
const currentLocale = locale ?? defaultLocale;
|
|
896
|
-
|
|
897
|
-
// पथ से लोकल उपसर्ग हटाएं ताकि एक आधार पथ बनाया जा सके
|
|
898
|
-
const pathWithoutLocale = getPathWithoutLocale(
|
|
899
|
-
pathname // वर्तमान URL पथ
|
|
900
|
-
);
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* यदि middleware.prefixDefault सत्य है, तो डिफ़ॉल्ट लोकल हमेशा उपसर्गित होना चाहिए।
|
|
904
|
-
*/
|
|
905
|
-
if (middleware.prefixDefault) {
|
|
906
|
-
// लोकल को मान्य करें
|
|
907
|
-
if (!locale || !locales.includes(locale)) {
|
|
908
|
-
// अपडेट किए गए पथ के साथ डिफ़ॉल्ट लोकल पर पुनर्निर्देशित करें
|
|
909
|
-
return (
|
|
910
|
-
<Navigate
|
|
911
|
-
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
912
|
-
replace // वर्तमान इतिहास प्रविष्टि को नए से बदलें
|
|
913
|
-
/>
|
|
914
|
-
);
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान लोकल सेट करें
|
|
918
|
-
return (
|
|
919
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
920
|
-
);
|
|
921
|
-
} else {
|
|
922
|
-
/**
|
|
923
|
-
* जब middleware.prefixDefault गलत होता है, तो डिफ़ॉल्ट लोकल उपसर्गित नहीं होता है।
|
|
924
|
-
* सुनिश्चित करें कि वर्तमान लोकल मान्य है और डिफ़ॉल्ट लोकल नहीं है।
|
|
925
|
-
*/
|
|
926
|
-
if (
|
|
927
|
-
currentLocale.toString() !== defaultLocale.toString() &&
|
|
928
|
-
!locales
|
|
929
|
-
.filter(
|
|
930
|
-
(locale) => locale.toString() !== defaultLocale.toString() // डिफ़ॉल्ट लोकल को बाहर करें
|
|
931
|
-
)
|
|
932
|
-
.includes(currentLocale) // जांचें कि वर्तमान लोकल मान्य लोकलों की सूची में है या नहीं
|
|
933
|
-
) {
|
|
934
|
-
// लोकल उपसर्ग के बिना पथ पर पुनर्निर्देशित करें
|
|
935
|
-
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
// बच्चों को IntlayerProvider के साथ लपेटें और वर्तमान लोकल सेट करें
|
|
939
|
-
return (
|
|
940
|
-
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
};
|
|
739
|
+
const { localeMap } = require("intlayer"); // 'intlayer' से उपयोगिता फ़ंक्शंस और प्रकार
|
|
740
|
+
const React = require("react"); // React को आयात करें
|
|
741
|
+
const { IntlayerProvider } = require("react-intlayer"); // अंतरराष्ट्रीयकरण संदर्भ के लिए प्रदाता
|
|
742
|
+
const { BrowserRouter, Route, Routes } = require("react-router-dom"); // नेविगेशन प्रबंधन के लिए राउटर घटक
|
|
944
743
|
|
|
945
744
|
/**
|
|
946
745
|
* एक राउटर कॉम्पोनेंट जो लोकल-विशिष्ट रूट सेट करता है।
|
|
947
746
|
* यह नेविगेशन प्रबंधित करने और स्थानीयकृत कॉम्पोनेंट्स को रेंडर करने के लिए React Router का उपयोग करता है।
|
|
948
747
|
*/
|
|
949
|
-
const LocaleRouter = ({ children }) =>
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
748
|
+
const LocaleRouter = ({ children }) =>
|
|
749
|
+
React.createElement(
|
|
750
|
+
BrowserRouter,
|
|
751
|
+
{},
|
|
752
|
+
React.createElement(
|
|
753
|
+
Routes,
|
|
754
|
+
{},
|
|
755
|
+
localeMap(({ locale, urlPrefix }) =>
|
|
756
|
+
React.createElement(Route, {
|
|
757
|
+
path: `${urlPrefix}/*`,
|
|
758
|
+
key: locale,
|
|
759
|
+
element: React.createElement(IntlayerProvider, { locale }, children),
|
|
760
|
+
})
|
|
761
|
+
)
|
|
762
|
+
)
|
|
763
|
+
);
|
|
964
764
|
|
|
965
|
-
|
|
966
|
-
// यदि डिफ़ॉल्ट लोकल के लिए उपसर्ग अक्षम है, तो बच्चों को सीधे रूट पथ पर रेंडर करें
|
|
967
|
-
!middleware.prefixDefault && (
|
|
968
|
-
<Route
|
|
969
|
-
path="*"
|
|
970
|
-
element={
|
|
971
|
-
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
972
|
-
} // बच्चों को लोकल प्रबंधन के साथ लपेटता है
|
|
973
|
-
/>
|
|
974
|
-
)
|
|
975
|
-
}
|
|
976
|
-
</Routes>
|
|
977
|
-
</BrowserRouter>
|
|
978
|
-
);
|
|
765
|
+
exports.LocaleRouter = LocaleRouter;
|
|
979
766
|
```
|
|
980
767
|
|
|
768
|
+
> नोट: यदि आप `routing.mode: 'no-prefix' | 'search-params'` का उपयोग करते हैं, तो आपको शायद `localeMap` फ़ंक्शन का उपयोग करने की आवश्यकता नहीं है।
|
|
769
|
+
|
|
981
770
|
फिर, आप अपने एप्लिकेशन में `LocaleRouter` कॉम्पोनेंट का उपयोग कर सकते हैं:
|
|
982
771
|
|
|
983
772
|
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
@@ -1019,6 +808,8 @@ const App = () => (
|
|
|
1019
808
|
|
|
1020
809
|
साथ ही, आप अपने एप्लिकेशन में सर्वर-साइड रूटिंग जोड़ने के लिए `intlayerProxy` का भी उपयोग कर सकते हैं। यह प्लगइन URL के आधार पर वर्तमान लोकल का स्वचालित रूप से पता लगाएगा और उपयुक्त लोकल कुकी सेट करेगा। यदि कोई लोकल निर्दिष्ट नहीं है, तो प्लगइन उपयोगकर्ता के ब्राउज़र भाषा प्राथमिकताओं के आधार पर सबसे उपयुक्त लोकल निर्धारित करेगा। यदि कोई लोकल पता नहीं चलता है, तो यह डिफ़ॉल्ट लोकल पर पुनर्निर्देशित करेगा।
|
|
1021
810
|
|
|
811
|
+
> ध्यान दें कि production में `intlayerProxy` का उपयोग करने के लिए, आपको `vite-intlayer` पैकेज को `devDependencies` से `dependencies` में स्विच करना होगा।
|
|
812
|
+
|
|
1022
813
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1023
814
|
import { defineConfig } from "vite";
|
|
1024
815
|
import react from "@vitejs/plugin-react-swc";
|
|
@@ -1426,13 +1217,13 @@ module.exports = App;
|
|
|
1426
1217
|
|
|
1427
1218
|
इन परिवर्तनों को लागू करने से, आपका एप्लिकेशन:
|
|
1428
1219
|
|
|
1429
|
-
- सुनिश्चित
|
|
1430
|
-
- लोकल के अनुसार **टेक्स्ट दिशा** (`dir`) को समायोजित
|
|
1431
|
-
- एक अधिक **सुलभ** अनुभव प्रदान
|
|
1220
|
+
- सुनिश्चित करें कि **भाषा** (`lang`) एट्रिब्यूट वर्तमान लोकल को सही ढंग से दर्शाए, जो SEO और ब्राउज़र व्यवहार के लिए महत्वपूर्ण है।
|
|
1221
|
+
- लोकल के अनुसार **टेक्स्ट दिशा** (`dir`) को समायोजित करें, जिससे विभिन्न पढ़ने के क्रम वाली भाषाओं के लिए पठनीयता और उपयोगिता बढ़े।
|
|
1222
|
+
- एक अधिक **सुलभ** अनुभव प्रदान करें, क्योंकि सहायक तकनीकें इन एट्रिब्यूट्स पर निर्भर करती हैं ताकि वे बेहतर तरीके से काम कर सकें।
|
|
1432
1223
|
|
|
1433
1224
|
### (वैकल्पिक) चरण 10: एक स्थानीयकृत लिंक कंपोनेंट बनाना
|
|
1434
1225
|
|
|
1435
|
-
यह सुनिश्चित करने के लिए कि आपके एप्लिकेशन की नेविगेशन वर्तमान लोकल का सम्मान करती है, आप एक कस्टम `Link` कंपोनेंट बना सकते हैं। यह कंपोनेंट स्वचालित रूप से आंतरिक URL को वर्तमान भाषा के साथ प्रीफिक्स करता
|
|
1226
|
+
यह सुनिश्चित करने के लिए कि आपके एप्लिकेशन की नेविगेशन वर्तमान लोकल का सम्मान करती है, आप एक कस्टम `Link` कंपोनेंट बना सकते हैं। यह कंपोनेंट स्वचालित रूप से आंतरिक URL को वर्तमान भाषा के साथ प्रीफिक्स करता है, ताकि उदाहरण के लिए, जब एक फ्रेंच-भाषी उपयोगकर्ता "About" पेज के लिंक पर क्लिक करता है, तो उसे `/fr/about` पर पुनः निर्देशित किया जाता है, न कि `/about` पर।
|
|
1436
1227
|
|
|
1437
1228
|
यह व्यवहार कई कारणों से उपयोगी है:
|
|
1438
1229
|
|
|
@@ -1451,11 +1242,10 @@ import {
|
|
|
1451
1242
|
} from "react";
|
|
1452
1243
|
import { useLocale } from "react-intlayer";
|
|
1453
1244
|
|
|
1454
|
-
export interface LinkProps
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
> {}
|
|
1245
|
+
export interface LinkProps extends DetailedHTMLProps<
|
|
1246
|
+
AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
1247
|
+
HTMLAnchorElement
|
|
1248
|
+
> {}
|
|
1459
1249
|
|
|
1460
1250
|
/**
|
|
1461
1251
|
* यह उपयोगिता फ़ंक्शन जांचता है कि दिया गया URL बाहरी है या नहीं।
|
|
@@ -1480,7 +1270,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
1480
1270
|
|
|
1481
1271
|
return (
|
|
1482
1272
|
<a href={hrefI18n} ref={ref} {...props}>
|
|
1483
|
-
|
|
1273
|
+
{children}
|
|
1484
1274
|
</a>
|
|
1485
1275
|
);
|
|
1486
1276
|
}
|
|
@@ -1506,7 +1296,6 @@ export const checkIsExternalLink = (href?: string): boolean =>
|
|
|
1506
1296
|
* आंतरिक लिंक के लिए, यह `getLocalizedUrl` का उपयोग करता है ताकि URL के आगे लोकल जोड़ा जा सके (जैसे, /fr/about)।
|
|
1507
1297
|
* यह सुनिश्चित करता है कि नेविगेशन उसी लोकल संदर्भ के भीतर बना रहे।
|
|
1508
1298
|
*/
|
|
1509
|
-
/
|
|
1510
1299
|
export const Link = forwardRef(({ href, children, ...props }, ref) => {
|
|
1511
1300
|
const { locale } = useLocale();
|
|
1512
1301
|
const isExternalLink = checkIsExternalLink(href);
|
|
@@ -1605,8 +1394,8 @@ Intlayer TypeScript के लाभ प्राप्त करने और
|
|
|
1605
1394
|
|
|
1606
1395
|
इसके लिए, आप अपनी `.gitignore` फ़ाइल में निम्नलिखित निर्देश जोड़ सकते हैं:
|
|
1607
1396
|
|
|
1608
|
-
```plaintext
|
|
1609
|
-
# Intlayer
|
|
1397
|
+
```plaintext fileName=".gitignore"
|
|
1398
|
+
# Intlayer द्वारा उत्पन्न फ़ाइलों को अनदेखा करें
|
|
1610
1399
|
.intlayer
|
|
1611
1400
|
```
|
|
1612
1401
|
|
|
@@ -1630,5 +1419,3 @@ Intlayer के साथ अपने विकास अनुभव को
|
|
|
1630
1419
|
### आगे बढ़ें
|
|
1631
1420
|
|
|
1632
1421
|
आगे बढ़ने के लिए, आप [विज़ुअल एडिटर](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_visual_editor.md) को लागू कर सकते हैं या अपनी सामग्री को [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_CMS.md) का उपयोग करके बाहरी रूप से प्रबंधित कर सकते हैं।
|
|
1633
|
-
|
|
1634
|
-
---
|