@intlayer/docs 7.0.4-canary.0 → 7.0.5

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,367 +1,163 @@
1
1
  ---
2
2
  createdAt: 2025-08-23
3
- updatedAt: 2025-08-23
4
- title: Intlayer وnext-i18next
5
- description: قم بدمج Intlayer مع next-i18next لتطبيق Next.js
3
+ updatedAt: 2025-10-29
4
+ title: إنتلاير و next-i18next
5
+ description: دمج إنتلاير مع next-i18next لحل شامل للتدويل في Next.js
6
6
  keywords:
7
7
  - i18next
8
8
  - next-i18next
9
9
  - Intlayer
10
10
  - التدويل
11
- - التوثيق
11
+ - مدونة
12
12
  - Next.js
13
- - JavaScript
13
+ - جافاسكريبت
14
14
  - React
15
15
  slugs:
16
16
  - blog
17
17
  - intlayer-with-next-i18next
18
+ history:
19
+ - version: 7.0.0
20
+ date: 2025-10-29
21
+ changes: التغيير إلى مكون syncJSON وإعادة كتابة شاملة
18
22
  ---
19
23
 
20
- # Next.js Internationalization (i18n) مع next-i18next و Intlayer
24
+ # التدويل في Next.js (i18n) باستخدام next-i18next و Intlayer
21
25
 
22
- كل من next-i18next و Intlayer هما إطاران مفتوحا المصدر للتدويل (i18n) مصممان لتطبيقات Next.js. يتم استخدامهما على نطاق واسع لإدارة الترجمات، والتعريب، وتبديل اللغة في مشاريع البرمجيات.
26
+ ## جدول المحتويات
23
27
 
24
- تتضمن كلا الحلقتين ثلاث مفاهيم رئيسية:
28
+ <TOC/>
25
29
 
26
- 1. **إعلان المحتوى**: الطريقة لتعريف المحتوى القابل للترجمة في تطبيقك.
27
- - يسمى `resource` في حالة `i18next`، إعلان المحتوى هو كائن JSON منظم يحتوي على أزواج مفتاح-قيمة للترجمات في لغة واحدة أو أكثر. راجع [وثائق i18next](https://www.i18next.com/translation-function/essentials) لمزيد من المعلومات.
28
- - يسمى `content declaration file` في حالة `Intlayer`، يمكن أن يكون إعلان المحتوى ملف JSON أو JS أو TS يقوم بتصدير البيانات المنسقة. راجع [وثائق Intlayer](https://intlayer.org/fr/doc/concept/content) لمزيد من المعلومات.
30
+ ## ما هو next-i18next؟
29
31
 
30
- 2. **الأدوات المساعدة**: أدوات لبناء وتفسير إعلانات المحتوى في التطبيق، مثل `getI18n()`، `useCurrentLocale()`، أو `useChangeLocale()` لـ next-i18next، و `useIntlayer()` أو `useLocale()` لـ Intlayer.
32
+ **next-i18next** هو أحد أكثر أُطُر التدويل (i18n) شعبية لتطبيقات Next.js. مبني على قمة النظام البيئي القوي **i18next**، ويوفر حلاً شاملاً لإدارة الترجمات، والتعريب، وتبديل اللغات في مشاريع Next.js.
31
33
 
32
- 3. **الإضافات والبرامج الوسيطة**: ميزات لإدارة إعادة توجيه URL، وتحسين التجميع، والمزيد، مثل `next-i18next/middleware` لـ next-i18next أو `intlayerMiddleware` لـ Intlayer.
34
+ ومع ذلك، يأتي next-i18next مع بعض التحديات:
33
35
 
34
- ## Intlayer مقابل i18next: الفرق الرئيسي
36
+ - **إعداد معقد**: يتطلب إعداد next-i18next ملفات إعداد متعددة وإعداد دقيق لحالات i18n على جانب الخادم والعميل.
37
+ - **ترجمات متفرقة**: عادةً ما تُخزن ملفات الترجمة في مجلدات منفصلة عن المكونات، مما يجعل الحفاظ على الاتساق أكثر صعوبة.
38
+ - **إدارة المساحات الاسمية يدويًا**: يحتاج المطورون إلى إدارة المساحات الاسمية يدويًا وضمان تحميل موارد الترجمة بشكل صحيح.
39
+ - **سلامة نوع محدودة**: يتطلب دعم TypeScript إعدادًا إضافيًا ولا يوفر توليد نوع تلقائي للترجمات.
35
40
 
36
- لاستكشاف الفروقات بين i18next و Intlayer، تحقق من منشور المدونة الخاص بنا [next-i18next vs. next-intl vs. Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/ar/i18next_vs_next-intl_vs_intlayer.md).
41
+ ## ما هو Intlayer؟
37
42
 
38
- ## كيفية توليد قواميس next-i18next مع Intlayer
43
+ **Intlayer** هو مكتبة تعريب مبتكرة ومفتوحة المصدر مصممة لمعالجة أوجه القصور في حلول i18n التقليدية. يقدم نهجًا حديثًا لإدارة المحتوى في تطبيقات Next.js.
39
44
 
40
- ### لماذا تستخدم Intlayer مع next-i18next؟
45
+ اطلع على مقارنة ملموسة مع next-intl في منشور المدونة الخاص بنا [next-i18next مقابل next-intl مقابل Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md).
41
46
 
42
- تقدم ملفات إعلان محتوى Intlayer عمومًا تجربة مطور أفضل. إنها أكثر مرونة وقابلية للصيانة بفضل ميزتين رئيسيتين:
47
+ ## لماذا الجمع بين Intlayer و next-i18next؟
43
48
 
44
- 1. **المكان المرن**: يمكن وضع ملف إعلان المحتوى Intlayer في أي مكان في شجرة ملفات التطبيق، مما يبسط إدارة المكونات المكررة أو المحذوفة دون ترك إعلانات محتوى غير مستخدمة.
49
+ بينما توفر Intlayer حلاً ممتازًا مستقلًا للترجمة الدولية (راجع دليل التكامل مع Next.js الخاص بنا [Next.js integration guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ar/intlayer_with_nextjs_16.md))، قد ترغب في دمجها مع next-i18next لأسباب عدة:
45
50
 
46
- أمثلة لهيكل الملفات:
51
+ 1. **قاعدة كود موجودة**: لديك تنفيذ قائم لـ next-i18next وترغب في الترحيل التدريجي إلى تجربة المطور المحسنة التي تقدمها Intlayer.
52
+ 2. **متطلبات قديمة**: مشروعك يتطلب التوافق مع الإضافات أو سير العمل الحالي لـ i18next.
53
+ 3. **ألفة الفريق**: فريقك معتاد على next-i18next ولكنه يرغب في إدارة محتوى أفضل.
47
54
 
48
- ```bash codeFormat="typescript"
49
- .
50
- └── src
51
- └── components
52
- └── MyComponent
53
- ├── index.content.ts # ملف إعلان المحتوى
54
- └── index.tsx
55
- ```
55
+ لهذا، يمكن تنفيذ Intlayer كمحول لـ next-i18next للمساعدة في أتمتة ترجمات JSON الخاصة بك في واجهة الأوامر أو خطوط أنابيب CI/CD، واختبار ترجماتك، والمزيد.
56
56
 
57
- ```bash codeFormat="esm"
58
- .
59
- └── src
60
- └── components
61
- └── MyComponent
62
- ├── index.content.mjs # ملف إعلان المحتوى
63
- └── index.mjx
64
- ```
57
+ يوضح هذا الدليل كيفية الاستفادة من نظام إعلان المحتوى المتفوق في Intlayer مع الحفاظ على التوافق مع next-i18next.
65
58
 
66
- ```bash codeFormat="cjs"
67
- .
68
- └── src
69
- └── components
70
- └── MyComponent
71
- ├── index.content.cjs # ملف إعلان المحتوى
72
- └── index.cjx
73
- ```
59
+ ---
74
60
 
75
- ```bash codeFormat="json"
76
- .
77
- └── src
78
- └── components
79
- └── MyComponent
80
- ├── index.content.json # ملف إعلان المحتوى
81
- └── index.jsx
82
- ```
61
+ ## دليل خطوة بخطوة لإعداد Intlayer مع next-i18next
83
62
 
84
- 2. **الترجمات المركزية**: تحفظ Intlayer جميع الترجمات في ملف واحد، مما يضمن عدم وجود ترجمة مفقودة. عند استخدام TypeScript، يتم اكتشاف الترجمات المفقودة تلقائيًا والإبلاغ عنها كأخطاء.
63
+ ### الخطوة 1: تثبيت التبعيات
85
64
 
86
- ### التثبيت
65
+ قم بتثبيت الحزم اللازمة باستخدام مدير الحزم المفضل لديك:
87
66
 
88
67
  ```bash packageManager="npm"
89
- npm install intlayer i18next next-i18next i18next-resources-to-backend
68
+ npm install intlayer @intlayer/sync-json-plugin
90
69
  ```
91
70
 
92
- ```bash packageManager="yarn"
93
- yarn add intlayer i18next next-i18next i18next-resources-to-backend
71
+ ```bash packageManager="pnpm"
72
+ pnpm add intlayer @intlayer/sync-json-plugin
94
73
  ```
95
74
 
96
- ```bash packageManager="pnpm"
97
- pnpm add intlayer i18next next-i18next i18next-resources-to-backend
75
+ ```bash packageManager="yarn"
76
+ yarn add intlayer @intlayer/sync-json-plugin
98
77
  ```
99
78
 
100
- ### تكوين Intlayer لتصدير قواميس i18next
79
+ **توضيحات الحزم:**
101
80
 
102
- > لا يضمن تصدير موارد i18next توافق 1:1 مع الإطارات الأخرى. يُوصى بالالتزام بتكوين قائم على Intlayer لتقليل المشكلات.
81
+ - **intlayer**: المكتبة الأساسية لإعلان المحتوى وإدارته
82
+ - **next-intlayer**: طبقة تكامل Next.js مع إضافات البناء
83
+ - **i18next**: إطار العمل الأساسي للتدويل (i18n)
84
+ - **next-i18next**: غلاف Next.js لـ i18next
85
+ - **i18next-resources-to-backend**: تحميل الموارد الديناميكي لـ i18next
86
+ - **@intlayer/sync-json-plugin**: إضافة لمزامنة إعلانات محتوى Intlayer مع صيغة JSON الخاصة بـ i18next
103
87
 
104
- لتصدير موارد i18next، قم بتكوين Intlayer في ملف `intlayer.config.ts`. أمثلة على التكوينات:
88
+ ### الخطوة 2: تنفيذ إضافة Intlayer لتغليف JSON
105
89
 
106
- ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
90
+ قم بإنشاء ملف تكوين Intlayer لتعريف اللغات المدعومة لديك:
91
+
92
+ **إذا كنت تريد أيضًا تصدير قواميس JSON لـ i18next**، أضف إضافة `syncJSON`:
93
+
94
+ ```typescript fileName="intlayer.config.ts"
107
95
  import { Locales, type IntlayerConfig } from "intlayer";
96
+ import { syncJSON } from "@intlayer/sync-json-plugin";
108
97
 
109
98
  const config: IntlayerConfig = {
110
99
  internationalization: {
111
100
  locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
112
101
  defaultLocale: Locales.ENGLISH,
113
102
  },
114
- content: {
115
- dictionaryOutput: ["i18next"],
116
- i18nextResourcesDir: "./i18next/resources",
117
- },
103
+ plugins: [
104
+ syncJSON({
105
+ source: ({ key, locale }) => `./messages/${locale}/${key}.json`,
106
+ }),
107
+ ],
118
108
  };
119
109
 
120
110
  export default config;
121
111
  ```
122
112
 
123
- ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
124
- import { Locales } from "intlayer";
125
-
126
- /** @type {import('intlayer').IntlayerConfig} */
127
- const config = {
128
- internationalization: {
129
- locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
130
- defaultLocale: Locales.ENGLISH,
131
- },
132
- content: {
133
- dictionaryOutput: ["i18next"],
134
- i18nextResourcesDir: "./i18next/resources",
135
- },
136
- };
113
+ ستقوم إضافة `syncJSON` تلقائيًا بتغليف ملفات JSON. ستقوم بقراءة وكتابة ملفات JSON دون تغيير هيكل المحتوى.
137
114
 
138
- export default config;
139
- ```
115
+ إذا كنت تريد جعل ملفات JSON تتعايش مع ملفات إعلان محتوى intlayer (`.content`)، فسيتم التعامل معها بهذه الطريقة:
140
116
 
141
- ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
142
- const { Locales } = require("intlayer");
143
-
144
- /** @type {import('intlayer').IntlayerConfig} */
145
- const config = {
146
- internationalization: {
147
- locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
148
- defaultLocale: Locales.ENGLISH,
149
- },
150
- content: {
151
- dictionaryOutput: ["i18next"],
152
- i18nextResourcesDir: "./i18next/resources",
153
- },
154
- };
117
+ 1. تحميل كل من ملفات JSON وملفات إعلان المحتوى وتحويلها إلى قاموس intlayer.
155
118
 
156
- module.exports = config;
157
- ```
119
+ 2. إذا كانت هناك تعارضات بين ملفات JSON وملفات إعلان المحتوى، فإن Intlayer سيقوم بدمج جميع القواميس. وذلك يعتمد على أولوية الإضافات، وأولوية ملف إعلان المحتوى (كلها قابلة للتكوين).
158
120
 
159
- هنا استمرارية وتصحيح الأجزاء المتبقية من المستند الخاص بك:
121
+ إذا تم إجراء تغييرات باستخدام واجهة الأوامر CLI لترجمة JSON، أو باستخدام نظام إدارة المحتوى CMS، فسيقوم Intlayer بتحديث ملف JSON بالترجمات الجديدة.
160
122
 
161
123
  ---
162
124
 
163
- ### استيراد القواميس إلى تكوين i18next الخاص بك
164
-
165
- لاستيراد الموارد المولدة إلى تكوين i18next الخاص بك، استخدم `i18next-resources-to-backend`. فيما يلي أمثلة:
166
-
167
- ```typescript fileName="i18n/client.ts" codeFormat="typescript"
168
- import i18next from "i18next";
169
- import resourcesToBackend from "i18next-resources-to-backend";
170
-
171
- i18next.use(
172
- resourcesToBackend(
173
- (language: string, namespace: string) =>
174
- import(`../i18next/resources/${language}/${namespace}.json`)
175
- )
176
- );
177
- ```
178
-
179
- ```javascript fileName="i18n/client.mjs" codeFormat="esm"
180
- import i18next from "i18next";
181
- import resourcesToBackend from "i18next-resources-to-backend";
182
-
183
- i18next.use(
184
- resourcesToBackend(
185
- (language, namespace) =>
186
- import(`../i18next/resources/${language}/${namespace}.json`)
187
- )
188
- );
189
- ```
125
+ ## تكوين Git
190
126
 
191
- ```javascript fileName="i18n/client.cjs" codeFormat="commonjs"
192
- const i18next = require("i18next");
193
- const resourcesToBackend = require("i18next-resources-to-backend");
127
+ استثناء الملفات المولدة من نظام التحكم في الإصدارات:
194
128
 
195
- i18next.use(
196
- resourcesToBackend(
197
- (language, namespace) =>
198
- import(`../i18next/resources/${language}/${namespace}.json`)
199
- )
200
- );
129
+ ```plaintext fileName=".gitignore"
130
+ # تجاهل الملفات التي تم إنشاؤها بواسطة Intlayer
131
+ .intlayer
132
+ intl
201
133
  ```
202
134
 
203
- ### إعلان المحتوى
135
+ يتم إعادة إنشاء هذه الملفات تلقائيًا أثناء عملية البناء ولا تحتاج إلى الالتزام بها في مستودعك.
204
136
 
205
- أمثلة على ملفات إعلان المحتوى بصيغ مختلفة:
137
+ ### إضافة VS Code
206
138
 
207
- ```typescript fileName="**/*.content.ts" contentDeclarationFormat="typescript"
208
- import { t, type Dictionary } from "intlayer";
139
+ لتحسين تجربة المطور، قم بتثبيت **إضافة Intlayer الرسمية لـ VS Code**:
209
140
 
210
- const content = {
211
- key: "my-content",
212
- content: {
213
- myTranslatedContent: t({
214
- en: "Hello World",
215
- es: "Hola Mundo",
216
- fr: "Bonjour le monde",
217
- }),
218
- },
219
- } satisfies Dictionary;
141
+ 2. إذا كان هناك تعارض بين ملفات JSON وملفات إعلان المحتوى، ستقوم Intlayer بدمج جميع القواميس. وذلك حسب أولوية الإضافات وأولوية ملف إعلان المحتوى (جميعها قابلة للتكوين).
220
142
 
221
- export default content;
222
- ```
143
+ إذا تم إجراء تغييرات باستخدام واجهة الأوامر CLI لترجمة JSON، أو باستخدام نظام إدارة المحتوى CMS، ستقوم Intlayer بتحديث ملف JSON بالترجمات الجديدة.
223
144
 
224
- ```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
225
- import { t } from "intlayer";
226
-
227
- /** @type {import('intlayer').Dictionary} */
228
- const content = {
229
- key: "my-content",
230
- content: {
231
- myTranslatedContent: t({
232
- en: "Hello World",
233
- es: "Hola Mundo",
234
- fr: "Bonjour le monde",
235
- }),
236
- },
237
- };
238
- ```
239
-
240
- ```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
241
- const { t } = require("intlayer");
242
-
243
- module.exports = {
244
- key: "my-content",
245
- content: {
246
- myTranslatedContent: t({
247
- en: "Hello World",
248
- es: "Hola Mundo",
249
- fr: "Bonjour le monde",
250
- }),
251
- },
252
- };
253
- ```
254
-
255
- ```json fileName="**/*.content.json" contentDeclarationFormat="json"
256
- {
257
- "$schema": "https://intlayer.org/schema.json",
258
- "key": "my-content",
259
- "content": {
260
- "myTranslatedContent": {
261
- "nodeType": "translation",
262
- "translation": {
263
- "en": "Hello World",
264
- "fr": "Bonjour le monde",
265
- "es": "Hola Mundo"
266
- }
267
- }
268
- }
269
- }
270
- ```
271
-
272
- ### بناء موارد next-i18next
273
-
274
- لبناء موارد next-i18next، قم بتشغيل الأمر التالي:
275
-
276
- ```bash packageManager="npm"
277
- npx run intlayer build
278
- ```
279
-
280
- ```bash packageManager="yarn"
281
- yarn intlayer build
282
- ```
283
-
284
- ```bash packageManager="pnpm"
285
- pnpm intlayer build
286
- ```
287
-
288
- سيؤدي ذلك إلى توليد الموارد في دليل `./i18next/resources`. الإخراج المتوقع:
289
-
290
- ```bash
291
- .
292
- └── i18next
293
- └── resources
294
- └── ar
295
- └── my-content.json
296
- └── fr
297
- └── my-content.json
298
- └── es
299
- └── my-content.json
300
- ```
301
-
302
- ملحوظة: يتوافق مساحة أسماء i18next مع مفتاح إعلان Intlayer.
303
-
304
- ### تنفيذ مكون Next.js
305
-
306
- بمجرد تكوينها، نفذ مكون Next.js لإعادة بناء موارد i18next الخاصة بك كلما تم تحديث ملفات إعلان محتوى Intlayer.
307
-
308
- ```typescript fileName="next.config.mjs"
309
- import { withIntlayer } from "next-intlayer/server";
310
-
311
- /** @type {import('next').NextConfig} */
312
- const nextConfig = {};
313
-
314
- export default withIntlayer(nextConfig);
315
- ```
316
-
317
- ### استخدام المحتوى في مكونات Next.js
318
-
319
- بعد تنفيذ مكون Next.js، يمكنك استخدام المحتوى في مكوناتك:
320
-
321
- ```typescript fileName="src/components/myComponent/index.tsx" codeFormat="typescript"
322
- import type { FC } from "react";
323
- import { useTranslation } from "react-i18next";
145
+ ---
324
146
 
325
- const IndexPage: FC = () => {
326
- const { t } = useTranslation();
147
+ ## إعداد Git
327
148
 
328
- return (
329
- <div>
330
- <h1>{t("my-content.title")}</h1>
331
- <p>{t("my-content.description")}</p>
332
- </div>
333
- );
334
- };
149
+ استبعاد الملفات المُولدة من نظام التحكم في الإصدارات:
335
150
 
336
- export default IndexPage;
151
+ ```plaintext fileName=".gitignore"
152
+ # تجاهل الملفات التي تم إنشاؤها بواسطة Intlayer
153
+ .intlayer
154
+ intl
337
155
  ```
338
156
 
339
- ```jsx fileName="src/components/myComponent/index.mjx" codeFormat="esm"
340
- import { useTranslation } from "react-i18next";
157
+ يتم إعادة إنشاء هذه الملفات تلقائيًا أثناء عملية البناء ولا تحتاج إلى الالتزام بها في مستودعك.
341
158
 
342
- const IndexPage = () => {
343
- const { t } = useTranslation();
159
+ ### إضافة VS Code
344
160
 
345
- return (
346
- <div>
347
- <h1>{t("my-content.title")}</h1>
348
- <p>{t("my-content.description")}</p>
349
- </div>
350
- );
351
- };
352
- ```
161
+ لتحسين تجربة المطور، قم بتثبيت **إضافة Intlayer الرسمية لـ VS Code**:
353
162
 
354
- ```jsx fileName="src/components/myComponent/index.cjx" codeFormat="commonjs"
355
- const { useTranslation } = require("react-i18next");
356
-
357
- const IndexPage = () => {
358
- const { t } = useTranslation();
359
-
360
- return (
361
- <div>
362
- <h1>{t("my-content.title")}</h1>
363
- <p>{t("my-content.description")}</p>
364
- </div>
365
- );
366
- };
367
- ```
163
+ [التثبيت من سوق VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)