@intlayer/docs 7.0.4-canary.0 → 7.0.4

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 (107) hide show
  1. package/blog/ar/intlayer_with_i18next.md +68 -106
  2. package/blog/ar/intlayer_with_next-i18next.md +84 -288
  3. package/blog/ar/intlayer_with_next-intl.md +58 -337
  4. package/blog/ar/intlayer_with_react-i18next.md +68 -290
  5. package/blog/ar/intlayer_with_react-intl.md +63 -266
  6. package/blog/de/intlayer_with_i18next.md +77 -97
  7. package/blog/de/intlayer_with_next-i18next.md +69 -296
  8. package/blog/de/intlayer_with_next-intl.md +59 -340
  9. package/blog/de/intlayer_with_react-i18next.md +68 -290
  10. package/blog/de/intlayer_with_react-intl.md +62 -264
  11. package/blog/en/intlayer_with_i18next.md +36 -1638
  12. package/blog/en/intlayer_with_next-i18next.md +22 -847
  13. package/blog/en/intlayer_with_next-intl.md +32 -1053
  14. package/blog/en/intlayer_with_react-i18next.md +38 -764
  15. package/blog/en/intlayer_with_react-intl.md +42 -1018
  16. package/blog/en-GB/intlayer_with_i18next.md +67 -103
  17. package/blog/en-GB/intlayer_with_next-i18next.md +71 -292
  18. package/blog/en-GB/intlayer_with_next-intl.md +58 -337
  19. package/blog/en-GB/intlayer_with_react-i18next.md +67 -289
  20. package/blog/en-GB/intlayer_with_react-intl.md +61 -264
  21. package/blog/es/intlayer_with_i18next.md +67 -103
  22. package/blog/es/intlayer_with_next-i18next.md +71 -296
  23. package/blog/es/intlayer_with_next-intl.md +57 -338
  24. package/blog/es/intlayer_with_react-i18next.md +68 -290
  25. package/blog/es/intlayer_with_react-intl.md +62 -265
  26. package/blog/fr/intlayer_with_i18next.md +66 -104
  27. package/blog/fr/intlayer_with_next-i18next.md +82 -285
  28. package/blog/fr/intlayer_with_next-intl.md +57 -338
  29. package/blog/fr/intlayer_with_react-i18next.md +67 -289
  30. package/blog/fr/intlayer_with_react-intl.md +61 -264
  31. package/blog/hi/intlayer_with_i18next.md +68 -104
  32. package/blog/hi/intlayer_with_next-i18next.md +74 -299
  33. package/blog/hi/intlayer_with_next-intl.md +57 -239
  34. package/blog/hi/intlayer_with_react-i18next.md +69 -291
  35. package/blog/hi/intlayer_with_react-intl.md +65 -268
  36. package/blog/id/intlayer_with_i18next.md +126 -0
  37. package/blog/id/intlayer_with_next-i18next.md +142 -0
  38. package/blog/id/intlayer_with_next-intl.md +113 -0
  39. package/blog/id/intlayer_with_react-i18next.md +124 -0
  40. package/blog/id/intlayer_with_react-intl.md +122 -0
  41. package/blog/it/intlayer_with_i18next.md +67 -103
  42. package/blog/it/intlayer_with_next-i18next.md +71 -296
  43. package/blog/it/intlayer_with_next-intl.md +57 -338
  44. package/blog/it/intlayer_with_react-i18next.md +68 -290
  45. package/blog/it/intlayer_with_react-intl.md +62 -265
  46. package/blog/ja/intlayer_with_i18next.md +68 -103
  47. package/blog/ja/intlayer_with_next-i18next.md +85 -283
  48. package/blog/ja/intlayer_with_next-intl.md +58 -336
  49. package/blog/ja/intlayer_with_react-i18next.md +68 -290
  50. package/blog/ja/intlayer_with_react-intl.md +62 -264
  51. package/blog/ko/intlayer_with_i18next.md +80 -96
  52. package/blog/ko/intlayer_with_next-i18next.md +85 -287
  53. package/blog/ko/intlayer_with_next-intl.md +68 -327
  54. package/blog/ko/intlayer_with_react-i18next.md +68 -290
  55. package/blog/ko/intlayer_with_react-intl.md +64 -266
  56. package/blog/pl/intlayer_with_i18next.md +126 -0
  57. package/blog/pl/intlayer_with_next-i18next.md +142 -0
  58. package/blog/pl/intlayer_with_next-intl.md +111 -0
  59. package/blog/pl/intlayer_with_react-i18next.md +124 -0
  60. package/blog/pl/intlayer_with_react-intl.md +122 -0
  61. package/blog/pt/intlayer_with_i18next.md +67 -103
  62. package/blog/pt/intlayer_with_next-i18next.md +72 -293
  63. package/blog/pt/intlayer_with_next-intl.md +57 -256
  64. package/blog/pt/intlayer_with_react-i18next.md +104 -78
  65. package/blog/pt/intlayer_with_react-intl.md +62 -266
  66. package/blog/ru/intlayer_with_i18next.md +66 -104
  67. package/blog/ru/intlayer_with_next-i18next.md +71 -296
  68. package/blog/ru/intlayer_with_next-intl.md +58 -337
  69. package/blog/ru/intlayer_with_react-i18next.md +68 -290
  70. package/blog/ru/intlayer_with_react-intl.md +62 -265
  71. package/blog/tr/intlayer_with_i18next.md +71 -107
  72. package/blog/tr/intlayer_with_next-i18next.md +72 -297
  73. package/blog/tr/intlayer_with_next-intl.md +58 -339
  74. package/blog/tr/intlayer_with_react-i18next.md +69 -291
  75. package/blog/tr/intlayer_with_react-intl.md +63 -285
  76. package/blog/vi/intlayer_with_i18next.md +126 -0
  77. package/blog/vi/intlayer_with_next-i18next.md +142 -0
  78. package/blog/vi/intlayer_with_next-intl.md +111 -0
  79. package/blog/vi/intlayer_with_react-i18next.md +124 -0
  80. package/blog/vi/intlayer_with_react-intl.md +122 -0
  81. package/blog/zh/intlayer_with_i18next.md +67 -102
  82. package/blog/zh/intlayer_with_next-i18next.md +72 -296
  83. package/blog/zh/intlayer_with_next-intl.md +58 -336
  84. package/blog/zh/intlayer_with_react-i18next.md +68 -290
  85. package/blog/zh/intlayer_with_react-intl.md +63 -106
  86. package/docs/ar/plugins/sync-json.md +244 -0
  87. package/docs/de/plugins/sync-json.md +244 -0
  88. package/docs/en/intlayer_cli.md +25 -0
  89. package/docs/en/intlayer_with_nextjs_14.md +2 -0
  90. package/docs/en/intlayer_with_nextjs_15.md +2 -0
  91. package/docs/en/intlayer_with_nextjs_16.md +2 -0
  92. package/docs/en/plugins/sync-json.md +1 -1
  93. package/docs/en-GB/plugins/sync-json.md +244 -0
  94. package/docs/es/plugins/sync-json.md +244 -0
  95. package/docs/fr/plugins/sync-json.md +244 -0
  96. package/docs/hi/plugins/sync-json.md +244 -0
  97. package/docs/id/plugins/sync-json.md +244 -0
  98. package/docs/it/plugins/sync-json.md +244 -0
  99. package/docs/ja/plugins/sync-json.md +244 -0
  100. package/docs/ko/plugins/sync-json.md +244 -0
  101. package/docs/pl/plugins/sync-json.md +244 -0
  102. package/docs/pt/plugins/sync-json.md +244 -0
  103. package/docs/ru/plugins/sync-json.md +244 -0
  104. package/docs/tr/plugins/sync-json.md +245 -0
  105. package/docs/vi/plugins/sync-json.md +244 -0
  106. package/docs/zh/plugins/sync-json.md +244 -0
  107. package/package.json +14 -14
@@ -1,346 +1,124 @@
1
1
  ---
2
2
  createdAt: 2025-01-02
3
- updatedAt: 2025-06-29
4
- title: Intlayer और react-i18next
5
- description: React एप्लिकेशन के लिए react-i18next के साथ Intlayer की तुलना करें
3
+ updatedAt: 2025-10-29
4
+ title: Intlayer का उपयोग करके अपने react-i18next JSON अनुवादों को स्वचालित कैसे करें
5
+ description: React एप्लिकेशन में बेहतर अंतरराष्ट्रीयकरण के लिए Intlayer और react-i18next के साथ अपने JSON अनुवादों को स्वचालित करें।
6
6
  keywords:
7
7
  - react-i18next
8
8
  - i18next
9
9
  - Intlayer
10
- - अंतर्राष्ट्रीयकरण
11
- - दस्तावेज़ीकरण
12
- - Next.js
13
- - JavaScript
10
+ - अंतरराष्ट्रीयकरण
11
+ - i18n
12
+ - ब्लॉग
14
13
  - React
14
+ - JavaScript
15
+ - TypeScript
16
+ - सामग्री प्रबंधन
15
17
  slugs:
16
18
  - blog
17
19
  - intlayer-with-react-i18next
20
+ history:
21
+ - version: 7.0.0
22
+ date: 2025-10-29
23
+ changes: syncJSON प्लगइन में बदलाव
18
24
  ---
19
25
 
20
- # React Internationalization (i18n) with react-i18next and Intlayer
21
-
22
- ## Overview
23
-
24
- - **Intlayer** आपको **component-level** सामग्री घोषणा फ़ाइलों के माध्यम से अनुवाद प्रबंधित करने में सहायता करता है।
25
- - **react-i18next** एक लोकप्रिय React एकीकरण है जो **i18next** के लिए `useTranslation` जैसे हुक प्रदान करता है ताकि आपके घटकों में स्थानीयकृत स्ट्रिंग्स प्राप्त की जा सकें।
26
-
27
- जब इनका संयोजन किया जाता है, Intlayer **i18next-संगत JSON** में शब्दकोशों को **निर्यात** कर सकता है ताकि react-i18next उन्हें रन-टाइम पर **उपयोग** कर सके।
28
-
29
- ## Why Use Intlayer with react-i18next?
30
-
31
- **Intlayer** सामग्री घोषणा फ़ाइलें बेहतर डेवलपर अनुभव प्रदान करती हैं क्योंकि वे:
32
-
33
- 1. **फाइल प्लेसमेंट में लचीली**
34
- प्रत्येक सामग्री घोषणा फ़ाइल को उस घटक के पास रखें जिसे इसकी आवश्यकता है। यह संरचना आपको अनुवादों को सह-स्थान पर रखने की अनुमति देती है, जब घटक स्थानांतरित होते हैं या हटा दिए जाते हैं।
35
-
36
- ```bash codeFormat="typescript"
37
- .
38
- └── src
39
- └── components
40
- └── MyComponent
41
- ├── index.content.ts # सामग्री घोषणा फ़ाइल
42
- └── index.tsx
43
- ```
44
-
45
- ```bash codeFormat="esm"
46
- .
47
- └── src
48
- └── components
49
- └── MyComponent
50
- ├── index.content.mjs # सामग्री घोषणा फ़ाइल
51
- └── index.mjx
52
- ```
53
-
54
- ```bash codeFormat="cjs"
55
- .
56
- └── src
57
- └── components
58
- └── MyComponent
59
- ├── index.content.cjs # सामग्री घोषणा फ़ाइल
60
- └── index.cjx
61
- ```
62
-
63
- ```bash codeFormat="json"
64
- .
65
- └── src
66
- └── components
67
- └── MyComponent
68
- ├── index.content.json # सामग्री घोषणा फ़ाइल
69
- └── index.jsx
70
- ```
71
-
72
- 2. **केंद्रित अनुवाद**
73
- एकल सामग्री घोषणा फ़ाइल किसी घटक के लिए सभी आवश्यक अनुवादों को एकत्रित करती है, जिससे गायब अनुवादों को पकड़ना आसान हो जाता है।
74
- TypeScript के साथ, यदि अनुवाद गायब हैं तो आपको संकलन-समय की त्रुटियाँ भी मिलती हैं।
75
-
76
- ## Installation
77
-
78
- एक Create React App प्रोजेक्ट में, इन निर्भरता को स्थापित करें:
79
-
80
- ```bash
81
- # npm के साथ
82
- npm install intlayer react-i18next i18next i18next-resources-to-backend
83
- ```
84
-
85
- ```bash
86
- # yarn के साथ
87
- yarn add intlayer react-i18next i18next i18next-resources-to-backend
88
- ```
89
-
90
- ```bash
91
- # pnpm के साथ
92
- pnpm add intlayer react-i18next i18next i18next-resources-to-backend
93
- ```
26
+ # Intlayer का उपयोग करके अपने react-i18next JSON अनुवादों को स्वचालित कैसे करें
94
27
 
95
- ### ये पैकेज क्या हैं?
28
+ ## Intlayer क्या है?
96
29
 
97
- - **intlayer** i18n कॉन्फ़िगरेशन, सामग्री विवरण, और शब्दकोश आउटपुट बनाने के लिए CLI और कोर पुस्तकालय।
98
- - **react-intlayer** – Intlayer के लिए React-विशिष्ट एकीकरण, विशेष रूप से शब्दकोशों के निर्माण को स्वचालित करने के लिए कुछ स्क्रिप्ट प्रदान करना।
99
- - **react-i18next** – i18next के लिए React-विशिष्ट एकीकरण लाइब्रेरी, जिसमें `useTranslation` हुक शामिल है।
100
- - **i18next** – अनुवाद प्रबंधन के लिए मौलिक ढांचा।
101
- - **i18next-resources-to-backend** – एक i18next बैकएंड जो JSON संसाधनों को डायनेमिक रूप से आयात करता है।
30
+ **Intlayer** एक अभिनव, ओपन-सोर्स अंतरराष्ट्रीयकरण लाइब्रेरी है जिसे पारंपरिक i18n समाधानों की कमियों को दूर करने के लिए डिज़ाइन किया गया है। यह React एप्लिकेशन में सामग्री प्रबंधन के लिए एक आधुनिक दृष्टिकोण प्रदान करता है।
102
31
 
103
- ## Configuring Intlayer to Export i18next Dictionaries
104
-
105
- अपने प्रोजेक्ट की जड़ में `intlayer.config.ts` बनाएं (या अपडेट करें):
106
-
107
- ```typescript title="intlayer.config.ts"
108
- import { Locales, type IntlayerConfig } from "intlayer";
109
-
110
- const config: IntlayerConfig = {
111
- internationalization: {
112
- // अपनी इच्छा से जितने चाहें स्थानीयताएँ जोड़ें
113
- locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
114
- defaultLocale: Locales.ENGLISH,
115
- },
116
- content: {
117
- // Intlayer को i18next-संगत JSON बनाने के लिए बताएं
118
- dictionaryOutput: ["i18next"],
32
+ react-i18next के साथ एक ठोस तुलना के लिए हमारे [react-i18next vs. react-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/hi/react-i18next_vs_react-intl_vs_intlayer.md) ब्लॉग पोस्ट देखें।
119
33
 
120
- // उत्पन्न संसाधनों के लिए एक आउटपुट डायरेक्टरी चुनें
121
- // यह फ़ोल्डर अगर अभी तक मौजूद नहीं है तो बनाया जाएगा।
122
- i18nextResourcesDir: "./i18next/resources",
123
- },
124
- };
34
+ ## Intlayer को react-i18next के साथ क्यों मिलाएं?
125
35
 
126
- export default config;
127
- ```
36
+ जबकि Intlayer एक उत्कृष्ट स्टैंडअलोन i18n समाधान प्रदान करता है (हमारे [React इंटीग्रेशन गाइड](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_with_vite+react.md) देखें), आप इसे कई कारणों से react-i18next के साथ मिलाना चाह सकते हैं:
128
37
 
129
- > **नोट**: यदि आप TypeScript का उपयोग नहीं कर रहे हैं, तो आप इस कॉन्फ़िग फ़ाइल को `.cjs`, `.mjs`, या `.js` के रूप में बना सकते हैं (और विस्तार से जानने के लिए [Intlayer docs](https://intlayer.org/hi/doc/concept/configuration) देखें)।
38
+ 1. **मौजूदा कोडबेस**: आपके पास एक स्थापित react-i18next इम्प्लीमेंटेशन है और आप धीरे-धीरे Intlayer के बेहतर डेवलपर अनुभव की ओर माइग्रेट करना चाहते हैं।
39
+ 2. **पुराने आवश्यकताएँ**: आपके प्रोजेक्ट को मौजूदा react-i18next प्लगइन्स या वर्कफ़्लोज़ के साथ संगतता की आवश्यकता है।
40
+ 3. **टीम की परिचितता**: आपकी टीम react-i18next के साथ सहज है लेकिन बेहतर सामग्री प्रबंधन चाहती है।
130
41
 
131
- ## Building the i18next Resources
42
+ **इसके लिए, Intlayer को react-i18next के लिए एक एडाप्टर के रूप में लागू किया जा सकता है जो CLI या CI/CD पाइपलाइनों में आपके JSON अनुवादों को स्वचालित करने, आपके अनुवादों का परीक्षण करने, और भी बहुत कुछ करने में मदद करता है।**
132
43
 
133
- एक बार आपकी सामग्री घोषणाएँ जगह में होने के बाद (अगली अनुभाग), **Intlayer निर्माण कमांड** चलाएँ:
44
+ यह गाइड आपको दिखाता है कि कैसे Intlayer की श्रेष्ठ सामग्री घोषणा प्रणाली का लाभ उठाते हुए react-i18next के साथ संगतता बनाए रखी जाए।
134
45
 
135
- ```bash
136
- # npm के साथ
137
- npx run intlayer build
138
- ```
46
+ ## सामग्री सूची
139
47
 
140
- ```bash
141
- # yarn के साथ
142
- yarn intlayer build
143
- ```
48
+ <TOC/>
144
49
 
145
- ```bash
146
- # pnpm के साथ
147
- pnpm intlayer build
148
- ```
50
+ ## react-i18next के साथ Intlayer सेटअप करने के लिए चरण-दर-चरण मार्गदर्शिका
149
51
 
150
- > इसका मतलब है कि आपकी i18next संसाधनों का उत्पादन `./i18next/resources` डायरेक्टरी के अंदर होगा।
52
+ ### चरण 1: निर्भरता स्थापित करें
151
53
 
152
- एक सामान्य आउटपुट इस तरह दिखाई दे सकता है:
54
+ आवश्यक पैकेज इंस्टॉल करें:
153
55
 
154
- ```bash
155
- .
156
- └── i18next
157
- └── resources
158
- ├── hi
159
- │ └── my-content.json
160
- ├── fr
161
- │ └── my-content.json
162
- └── es
163
- └── my-content.json
56
+ ```bash packageManager="npm"
57
+ npm install intlayer @intlayer/sync-json-plugin
164
58
  ```
165
59
 
166
- जहाँ प्रत्येक **Intlayer** घोषणा कुंजी का उपयोग एक **i18next नेमस्पेस** के रूप में किया जाता है (जैसे, `my-content.json`)।
167
-
168
- ## Importing Dictionaries into Your react-i18next Configuration
169
-
170
- इन संसाधनों को रन-टाइम पर डायनेमिक रूप से लोड करने के लिए, [`i18next-resources-to-backend`](https://www.npmjs.com/package/i18next-resources-to-backend) का उपयोग करें। उदाहरण के लिए, अपने प्रोजेक्ट में एक `i18n.ts` (या `.js`) फ़ाइल बनाएं:
171
-
172
- ```typescript title="i18n.ts"
173
- import i18next from "i18next";
174
- import { initReactI18next } from "react-i18next";
175
- import resourcesToBackend from "i18next-resources-to-backend";
176
-
177
- i18next
178
- // react-i18next प्लगइन
179
- .use(initReactI18next)
180
- // डायनेमिक रूप से संसाधनों को लोड करें
181
- .use(
182
- resourcesToBackend((language: string, namespace: string) => {
183
- // अपने संसाधनों की डायरेक्टरी के लिए आयात पथ समायोजित करें
184
- return import(`../i18next/resources/${language}/${namespace}.json`);
185
- })
186
- )
187
- // i18next प्रारंभ करें
188
- .init({
189
- // बैकअप स्थानीयता
190
- fallbackLng: "hi",
191
-
192
- // आप यहाँ अन्य i18next कॉन्फ़िग विकल्प जोड़ सकते हैं, देखें:
193
- // https://www.i18next.com/overview/configuration-options
194
- });
195
-
196
- export default i18next;
60
+ ```bash packageManager="pnpm"
61
+ pnpm add intlayer @intlayer/sync-json-plugin
197
62
  ```
198
63
 
199
- ```javascript title="i18n.js"
200
- import i18next from "i18next";
201
- import { initReactI18next } from "react-i18next";
202
- import resourcesToBackend from "i18next-resources-to-backend";
203
-
204
- i18next
205
- .use(initReactI18next)
206
- .use(
207
- resourcesToBackend(
208
- (language, namespace) =>
209
- import(`../i18next/resources/${language}/${namespace}.json`)
210
- )
211
- )
212
- .init({
213
- fallbackLng: "hi",
214
- });
215
-
216
- export default i18next;
64
+ ```bash packageManager="yarn"
65
+ yarn add intlayer @intlayer/sync-json-plugin
217
66
  ```
218
67
 
219
- फिर, अपने **root** या **index** फ़ाइल (जैसे, `src/index.tsx`) में इस `i18n` सेटअप को **App** को रेंडर करने से **पहले** आयात करें:
68
+ **पैकेज विवरण:**
220
69
 
221
- ```typescript
222
- import React from "react";
223
- import ReactDOM from "react-dom/client";
224
- // कुछ और करने से पहले i18n को प्रारंभ करें
225
- import "./i18n";
226
- import App from "./App";
70
+ - **intlayer**: अंतरराष्ट्रीयकरण प्रबंधन, सामग्री घोषणा, और निर्माण के लिए मुख्य लाइब्रेरी
71
+ - **@intlayer/sync-json-plugin**: Intlayer सामग्री घोषणाओं को react-i18next संगत JSON प्रारूप में निर्यात करने के लिए प्लगइन
227
72
 
228
- ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
229
- <React.StrictMode>
230
- <App />
231
- </React.StrictMode>
232
- );
233
- ```
73
+ ### चरण 2: JSON को रैप करने के लिए Intlayer प्लगइन लागू करें
234
74
 
235
- ## Creating and Managing Your Dictionarys
75
+ अपने समर्थित लोकल्स को परिभाषित करने के लिए एक Intlayer कॉन्फ़िगरेशन फ़ाइल बनाएं:
236
76
 
237
- Intlayer सामग्री घोषणाओं को `./src` के तहत कहीं से भी निकालता है (डिफ़ॉल्ट रूप से)।
238
- यहाँ TypeScript में एक न्यूनतम उदाहरण है:
77
+ **यदि आप react-i18next के लिए JSON शब्दकोश भी निर्यात करना चाहते हैं**, तो `syncJSON` प्लगइन जोड़ें:
239
78
 
240
- ```typescript title="src/components/MyComponent/MyComponent.content.ts"
241
- import { t, type Dictionary } from "intlayer";
79
+ ```typescript fileName="intlayer.config.ts"
80
+ import { Locales, type IntlayerConfig } from "intlayer";
81
+ import { syncJSON } from "@intlayer/sync-json-plugin";
242
82
 
243
- const content = {
244
- // "key" आपके i18next नेमस्पेस होगा (जैसे, "my-component")
245
- key: "my-component",
246
- content: {
247
- // प्रत्येक "t" कॉल एक अलग अनुवाद नोड है
248
- heading: t({
249
- en: "Hello World",
250
- es: "Hola Mundo",
251
- fr: "Bonjour le monde",
252
- }),
253
- description: t({
254
- en: "My i18n description text...",
255
- fr: "Ma description en i18n...",
256
- es: "Mi descripción en i18n...",
257
- }),
83
+ const config: IntlayerConfig = {
84
+ internationalization: {
85
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
86
+ defaultLocale: Locales.ENGLISH,
258
87
  },
259
- } satisfies Dictionary;
260
-
261
- export default content;
262
- ```
263
-
264
- यदि आप JSON, `.cjs`, या `.mjs` पसंद करते हैं, तो [Intlayer docs](https://intlayer.org/hi/doc/concept/content) देखें।
265
-
266
- > डिफ़ॉल्ट रूप से, मान्य सामग्री घोषणाएँ फ़ाइल एक्सटेंशन पैटर्न से मेल खाती हैं:
267
-
268
- > `*.content.{ts,tsx,js,jsx,mjs,mjx,cjs,cjx,json}`
269
-
270
- ## Using the Translations in React Components
271
-
272
- एक बार जब आपने अपने Intlayer संसाधनों को **बना लिया** और react-i18next को कॉन्फ़िगर कर लिया, तो आप सीधे **react-i18next** के `useTranslation` हुक का उपयोग कर सकते हैं।
273
- उदाहरण के लिए:
274
-
275
- ```tsx title="src/components/MyComponent/MyComponent.tsx"
276
- import type { FC } from "react";
277
- import { useTranslation } from "react-i18next";
278
-
279
- /**
280
- * i18next "namespace" Intlayer की `key` है "MyComponent.content.ts" से
281
- * इसलिए हम useTranslation() को "my-component" पास करेंगे।
282
- */
283
- const MyComponent: FC = () => {
284
- const { t } = useTranslation("my-component");
285
-
286
- return (
287
- <div>
288
- <h1>{t("heading")}</h1>
289
- <p>{t("description")}</p>
290
- </div>
291
- );
88
+ plugins: [
89
+ syncJSON({
90
+ source: ({ key, locale }) => `./messages/${locale}/${key}.json`,
91
+ }),
92
+ ],
292
93
  };
293
94
 
294
- export default MyComponent;
95
+ export default config;
295
96
  ```
296
97
 
297
- > ध्यान दें कि `t` फ़ंक्शन आपके उत्पन्न JSON के अंदर **कीज़** को संदर्भित करता है। एक Intlayer सामग्री प्रविष्टि जिसका नाम `heading` है, आप `t("heading")` का उपयोग करेंगे।
98
+ `syncJSON` प्लगइन स्वचालित रूप से JSON को रैप करेगा। यह JSON फाइलों को पढ़ेगा और लिखेगा बिना सामग्री संरचना को बदले।
298
99
 
299
- ## Optional: Integrate with Create React App Scripts (CRACO)
100
+ यदि आप उस JSON को intlayer सामग्री घोषणा फ़ाइलों (`.content` फ़ाइलें) के साथ सह-अस्तित्व में रखना चाहते हैं, तो Intlayer इस प्रकार आगे बढ़ेगा:
300
101
 
301
- **react-intlayer** एक CRACO-आधारित दृष्टिकोण प्रदान करता है कस्टम बिल्ड और विकास सर्वर कॉन्फ़िगरेशन के लिए। यदि आप Intlayer के निर्माण चरण को निर्बाध रूप से एकीकृत करना चाहते हैं, तो आप:
102
+ 1. JSON और सामग्री घोषणा फ़ाइलों दोनों को लोड करें और उन्हें intlayer शब्दकोश में परिवर्तित करें।
103
+ 2. यदि JSON और सामग्री घोषणा फ़ाइलों के बीच कोई संघर्ष होता है, तो Intlayer उन सभी शब्दकोशों को मर्ज करने की प्रक्रिया करेगा। यह प्लगइन्स की प्राथमिकता और सामग्री घोषणा फ़ाइल की प्राथमिकता पर निर्भर करता है (सभी कॉन्फ़िगर करने योग्य हैं)।
302
104
 
303
- 1. **react-intlayer स्थापित करें** (यदि आपने नहीं किया है):
304
- ```bash
305
- npm install react-intlayer --save-dev
306
- ```
307
- 2. **अपने `package.json` स्क्रिप्ट्स** को `react-intlayer` स्क्रिप्ट्स का उपयोग करने के लिए समायोजित करें:
105
+ यदि CLI का उपयोग करके JSON का अनुवाद किया जाता है, या CMS का उपयोग किया जाता है, तो Intlayer नई अनुवादों के साथ JSON फ़ाइल को अपडेट करेगा।
308
106
 
309
- ```jsonc
310
- "scripts": {
311
- "start": "react-intlayer start",
312
- "build": "react-intlayer build",
313
- "transpile": "intlayer build"
314
- }
315
- ```
107
+ `syncJSON` प्लगइन के बारे में अधिक विवरण देखने के लिए, कृपया [syncJSON प्लगइन दस्तावेज़](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/plugins/sync-json.md) देखें।
316
108
 
317
- > `react-intlayer` स्क्रिप्ट्स [CRACO](https://craco.js.org/) पर आधारित हैं। आप intlayer craco प्लगइन के आधार पर अपनी सेटअप को भी कार्यान्वित कर सकते हैं। [देखें उदाहरण यहाँ](https://github.com/aymericzip/intlayer/blob/main/examples/react-app/craco.config.js)।
109
+ ## Git कॉन्फ़िगरेशन
318
110
 
319
- अब, `npm run build`, `yarn build`, या `pnpm build` चलाना Intlayer और CRA बिल्ड को ट्रिगर करता है।
111
+ स्वचालित रूप से उत्पन्न Intlayer फ़ाइलों को अनदेखा करना अनुशंसित है:
320
112
 
321
- ## TypeScript Configuration
322
-
323
- **Intlayer** आपके सामग्री के लिए **स्वचालित रूप से उत्पन्न टाइप परिभाषाएँ** प्रदान करता है। यह सुनिश्चित करने के लिए कि TypeScript उन्हें उठाता है, **`types`** (या यदि आपने अलग तरीके से कॉन्फ़िगर किया है तो `types`) अपने `tsconfig.json` **include** ऐरे में जोड़ें:
324
-
325
- ```json5 title="tsconfig.json"
326
- {
327
- "compilerOptions": {
328
- // ...
329
- },
330
- "include": ["src", "types"],
331
- }
113
+ ```plaintext fileName=".gitignore"
114
+ # Intlayer द्वारा उत्पन्न फ़ाइलों को अनदेखा करें
115
+ .intlayer
332
116
  ```
333
117
 
334
- > यह TypeScript को आपके अनुवादों के आकार का अनुमान लगाने के लिए अनुमति देगा ताकि बेहतर ऑटो-पूर्णता और त्रुटि पहचान हो सके।
335
-
336
- ## Git Configuration
118
+ ये फ़ाइलें आपके बिल्ड प्रक्रिया के दौरान पुनः उत्पन्न की जा सकती हैं और इन्हें संस्करण नियंत्रण में कमिट करने की आवश्यकता नहीं है।
337
119
 
338
- यह अनुशंसा की जाती है कि आप Intlayer से स्वत: उत्पन्न फ़ाइलों और फ़ोल्डरों को **अनदेखा** करें। अपने `.gitignore` में यह पंक्ति जोड़ें:
120
+ ### VS कोड एक्सटेंशन
339
121
 
340
- ```plaintext
341
- # Intlayer द्वारा उत्पन्न फ़ाइलों को अनदेखा करें
342
- .intlayer
343
- i18next
344
- ```
122
+ बेहतर डेवलपर अनुभव के लिए, आधिकारिक **Intlayer VS कोड एक्सटेंशन** इंस्टॉल करें:
345
123
 
346
- आप आमतौर पर इन संसाधनों या `.intlayer` आंतरिक निर्माण आर्टिफैक्ट्स को कमिट नहीं करते हैं, क्योंकि इन्हें प्रत्येक बिल्ड पर पुनः उत्पन्न किया जा सकता है।
124
+ [VS कोड मार्केटप्लेस से इंस्टॉल करें](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)