Skip to content

Commit d80e707

Browse files
committed
translate remainder of the page
1 parent b51c092 commit d80e707

2 files changed

Lines changed: 49 additions & 50 deletions

File tree

src/content/learn/your-first-component.md

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ title: مكوّنك الأول
3333

3434
يمثل هذا الترميز المرئي هذه المقالة `<article>`, عنوانها `<h1>`, وفهرس محتويات مختصر في شكل قائمة مرتبة `<ol>`. ترميز مرئي كهذا, مدمج مع CSS من أجل الأنماط التصميمية, و JavaScript من أجل التفاعلية, يكمن وراء كل شريط جانبي, صورة رمزية, نافذة, قائمة منسدلة - كل قطعة من واجهة مستخدم تراها في الويب.
3535

36-
تمكنك React من دمج الترميز المرئي, وCSS, وJavaScript في "مكونات" مخصصة, **عناصر واجهة المستخدم قابلة لإعادة الاستخدام لتطبيقك**. يمكن تحويل كود فهرس المحتوى الذي رأيته أعلاه الى مكوّن `<TableOfContents />` الذي يمكن تصييره في كل صفحة. لا يزال يستخدم هذا المكوّن تحت الخطاء وسوم مثل `<article>`, `<h1>`, إلخ.
36+
تمكنك React من دمج الترميز المرئي, وCSS, وJavaScript في "مكونات" مخصصة, **عناصر واجهة المستخدم قابلة لإعادة الاستخدام لتطبيقك**. يمكن تحويل كود فهرس المحتوى الذي رأيته أعلاه إلى مكوّن `<TableOfContents />` الذي يمكن تصييره في كل صفحة. لا يزال يستخدم هذا المكوّن تحت الخطاء وسوم مثل `<article>`, `<h1>`, إلخ.
3737

3838
تمامًا مثل الوسوم HTML، يمكنك تجميع وترتيب وتضمين المكوّنات لتصميم صفحات كاملة. على سبيل المثال، صفحة المستندات التي تقرأها مصنوعة من مكوّنات React.
3939

@@ -51,7 +51,7 @@ title: مكوّنك الأول
5151
</PageLayout>
5252
```
5353

54-
مع نمو مشروعك, ستلاحظ انه يمكن تجميع العديد من تصاميمك بواسطة إعادة استخدام مكوّنات كتبتها مسبقا, مما يسرع عملية التطوير. يمكن إضافة فهرس المحتويات أعلاه الى أي شاشة عن طريق `<TableOfContents />`! يمكنك أيضا الإنطلاق بسرعة في مشروعك باستخدام آلاف المكوّنات المشتركة من قبل مجتمع React مفتوحة المصدر مثل [Chakra UI](https://chakra-ui.com/) و [Material UI.](https://material-ui.com/).
54+
مع نمو مشروعك, ستلاحظ انه يمكن تجميع العديد من تصاميمك بواسطة إعادة استخدام مكوّنات كتبتها مسبقا, مما يسرع عملية التطوير. يمكن إضافة فهرس المحتويات أعلاه إلى أي شاشة عن طريق `<TableOfContents />`! يمكنك أيضا الإنطلاق بسرعة في مشروعك باستخدام آلاف المكوّنات المشتركة من قبل مجتمع React مفتوحة المصدر مثل [Chakra UI](https://chakra-ui.com/) و [Material UI.](https://material-ui.com/).
5555

5656
## تعريف المكوّن {/*defining-a-component*/}
5757

@@ -159,8 +159,6 @@ img { margin: 0 10px 10px 0; height: 90px; }
159159
* `<section>` هو بحروف صغيرة، لذا تعرف React أننا نشير إلى وسم HTML.
160160
* `<Profile />` يبدأ بحرف `P` كبير, لذا تعرف React أننا نريد استخدام مكوّننا الذي إسمه `Profile`.
161161

162-
And `Profile` contains even more HTML: `<img />`. In the end, this is what the browser sees:
163-
164162
ومكوّن `Profile` يحتوي على المزيد من HTML:`<img />`. في النهاية, هذا ما يراه المتصفح:
165163

166164
```html
@@ -174,73 +172,73 @@ And `Profile` contains even more HTML: `<img />`. In the end, this is what the b
174172

175173
### تضمين وتنظيم المكوّنات {/*nesting-and-organizing-components*/}
176174

177-
Components are regular JavaScript functions, so you can keep multiple components in the same file. This is convenient when components are relatively small or tightly related to each other. If this file gets crowded, you can always move `Profile` to a separate file. You will learn how to do this shortly on the [page about imports.](/learn/importing-and-exporting-components)
175+
المكوّنات هي دوال JavaScript عادية، لذا يمكنك الاحتفاظ بعدة مكوّنات في نفس الملف. هذا مناسب عندما تكون المكوّنات صغيرة نسبيًا أو تتعلق بشكل وثيق ببعضها البعض. إذا أصبح الملف مكتظًا، يمكنك دائمًا نقل المكوّن `Profile` إلى ملف منفصل. ستتعلم كيفية فعل ذلك قريبًا في [الصفحة التي تتحدث عن الاستيرادات.](/learn/importing-and-exporting-components).
178176

179-
Because the `Profile` components are rendered inside `Gallery`—even several times!—we can say that `Gallery` is a **parent component,** rendering each `Profile` as a "child". This is part of the magic of React: you can define a component once, and then use it in as many places and as many times as you like.
177+
نظرًا لأن مكوّنات `Profile` يتم تصييرها داخل مكوّن `Gallery` - وحتى لعدة مرات! - يمكننا القول بأن مكون `Gallery` هو **المكوّن الأب**، الذي يقوم بتصيير كل مكوّن `Profile` كـ "ابن" . هذا جزء من سحر React: يمكنك تعريف مكوّن مرة واحدة، ثم استخدامه في العديد من الأماكن وفي العديد من الأحيان كما تريد.
180178

181179
<Pitfall>
182180

183-
Components can render other components, but **you must never nest their definitions:**
181+
يمكن للمكوّنات عرض مكوّنات أخرى، ولكن **يجب ألا تقوم أبدا بتضمين تعريفها داخل بعضها البعض**.
184182

185183
```js {2-5}
186184
export default function Gallery() {
187-
// 🔴 Never define a component inside another component!
185+
// 🔴 لا تقم أبدا بتعريف مكوّن داخل مكوّن اخر
188186
function Profile() {
189187
// ...
190188
}
191189
// ...
192190
}
193191
```
194192

195-
The snippet above is [very slow and causes bugs.](/learn/preserving-and-resetting-state#different-components-at-the-same-position-reset-state) Instead, define every component at the top level:
193+
الكود السابق [بطيء جدًا ويسبب أخطاء.](/learn/preserving-and-resetting-state#different-components-at-the-same-position-reset-state) بدلاً من ذلك، قم بتعريف كل مكوّن على المستوى الأعلى
196194

197195
```js {5-8}
198196
export default function Gallery() {
199197
// ...
200198
}
201199

202-
//Declare components at the top level
200+
//قم بتعريف المكوّنات على المستوى الأعلى
203201
function Profile() {
204202
// ...
205203
}
206204
```
207205

208-
When a child component needs some data from a parent, [pass it by props](/learn/passing-props-to-a-component) instead of nesting definitions.
206+
عندما يحتاج المكوّن الابن إلى الحصول على بعض البيانات من المكوّن الأب، يتم [تمريرها كخواص](/learn/passing-props-to-a-component) بدلاً من تضمين تعريفاتها.
209207

210208
</Pitfall>
211209

212210
<DeepDive>
213211

214-
#### Components all the way down {/*components-all-the-way-down*/}
212+
#### مكوّنات على طول الطريق {/*components-all-the-way-down*/}
215213

216-
Your React application begins at a "root" component. Usually, it is created automatically when you start a new project. For example, if you use [CodeSandbox](https://codesandbox.io/) or [Create React App](https://create-react-app.dev/), the root component is defined in `src/App.js`. If you use the framework [Next.js](https://nextjs.org/), the root component is defined in `pages/index.js`. In these examples, you've been exporting root components.
214+
يبدأ تطبيق React الخاص بك في مكوّن "الجذر". عادةً ما يتم إنشاؤه تلقائيًا عند بدء مشروع جديد. على سبيل المثال، إذا كنت تستخدم [CodeSandbox](https://codesandbox.io/) أو [Create React App](https://create-react-app.dev/)، يتم تعريف مكون الجذر في `src/App.js`. إذا كنت تستخدم إطار العمل [Next.js](https://nextjs.org/)، يتم تعريف مكون الجذر في `pages/index.js`. في هذه الأمثلة، كنت تقوم بتصدير مكونات الجذر.
217215

218-
Most React apps use components all the way down. This means that you won't only use components for reusable pieces like buttons, but also for larger pieces like sidebars, lists, and ultimately, complete pages! Components are a handy way to organize UI code and markup, even if some of them are only used once.
216+
معظم تطبيقات React تستخدم مكوّنات على طول الطريق. وهذا يعني أنك لن تستخدم المكونات فقط للأجزاء القابلة لإعادة الاستخدام مثل الأزرار، ولكن أيضًا للأجزاء الأكبر مثل الأشرطة الجانبية، والقوائم، وفي النهاية، الصفحات الكاملة! المكوّنات هي وسيلة مفيدة لتنظيم كود واجهة المستخدم والترميز المرئي، حتى لو كان بعضها لا يستخدم سوى مرة واحدة.
219217

220-
[React-based frameworks](/learn/start-a-new-react-project) take this a step further. Instead of using an empty HTML file and letting React "take over" managing the page with JavaScript, they *also* generate the HTML automatically from your React components. This allows your app to show some content before the JavaScript code loads.
218+
[أطر العمل المبنية على React](/learn/start-a-new-react-project) تأخذ خطوة إضافية. بحيث بدلاً من استخدام ملف HTML فارغ والسماح لـ React بـ "الاستيلاء" على إدارة الصفحة بواسطة JavaScript، فإنها *أيضًا* تقوم بتوليد كود الـ HTML تلقائيًا من مكوّنات React الخاصة بك. هذا يسمح لتطبيقك بعرض بعض المحتوى قبل تحميل كود JavaScript.
221219

222-
Still, many websites only use React to [add interactivity to existing HTML pages.](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page) They have many root components instead of a single one for the entire page. You can use as much—or as little—React as you need.
220+
ومع ذلك، لا تزال هناك العديد من المواقع التي تستخدم React فقط [لإضافة التفاعلية إلى صفحات HTML الموجودة مسبقا.](/learn/add-react-to-an-existing-project#using-react-for-a-part-of-your-existing-page) فلديها العديد من المكوّنات الجذرية بدلاً من وجود مكوّن جذر واحد للصفحة بأكملها. يمكنك استخدام React بالمقدار الذي تحتاج إليه.
223221

224222
</DeepDive>
225223

226224
<Recap>
227225

228-
You've just gotten your first taste of React! Let's recap some key points.
226+
لقد حصلت للتو على لمحة أولى عن React! دعنا نلخص بعض النقاط الرئيسية.
229227

230-
* React lets you create components, **reusable UI elements for your app.**
231-
* In a React app, every piece of UI is a component.
232-
* React components are regular JavaScript functions except:
228+
* تمكنك React من إنشاء مكوّنات, **عناصر واجهة المستخدم قابلة لإعادة الاستخدام لتطبيقك**
229+
* في تطبيق React, كل قطعة من واجهة المستخدم تمثل مكوّن
230+
* مكوّنات React هي عبارة عن دوال JavaScript عادية ما عدا أن:
233231

234-
1. Their names always begin with a capital letter.
235-
2. They return JSX markup.
232+
1. إسمهم يبدأ دائما بحرف كبير.
233+
2. تقوم بإرجاع ترميز مرئي JSX
236234

237235
</Recap>
238236

239237
<Challenges>
240238

241-
#### Export the component {/*export-the-component*/}
239+
#### قم بتصدير المكوّن {/*export-the-component*/}
242240

243-
This sandbox doesn't work because the root component is not exported:
241+
هذا الكود لا يعمل لأن المكوّن الجذري لم يتم تصديره
244242

245243
<Sandpack>
246244

@@ -249,7 +247,7 @@ function Profile() {
249247
return (
250248
<img
251249
src="https://i.imgur.com/lICfvbD.jpg"
252-
alt="Aklilu Lemma"
250+
alt="أكليلو ليما"
253251
/>
254252
);
255253
}
@@ -261,11 +259,11 @@ img { height: 181px; }
261259

262260
</Sandpack>
263261

264-
Try to fix it yourself before looking at the solution!
262+
حاول إصلاحه بنفسك قبل أن تلقي نظرة على الحل!
265263

266264
<Solution>
267265

268-
Add `export default` before the function definition like so:
266+
قم بإضافة `export default` قبل تعريف الدالة بهذا الشكل:
269267

270268
<Sandpack>
271269

@@ -274,7 +272,8 @@ export default function Profile() {
274272
return (
275273
<img
276274
src="https://i.imgur.com/lICfvbD.jpg"
277-
alt="Aklilu Lemma"
275+
alt="أكليلو ليما"
276+
278277
/>
279278
);
280279
}
@@ -286,17 +285,17 @@ img { height: 181px; }
286285

287286
</Sandpack>
288287

289-
You might be wondering why writing `export` alone is not enough to fix this example. You can learn the difference between `export` and `export default` in [Importing and Exporting Components.](/learn/importing-and-exporting-components)
288+
قد تتساءل لماذا كتابة `export` بمفردها ليس كافيًا لإصلاح هذا المثال. يمكنك معرفة الفرق بين `export` و `export default` في قسم [استيراد وتصدير المكوّنات.](/learn/importing-and-exporting-components)
290289

291290
</Solution>
292291

293-
#### Fix the return statement {/*fix-the-return-statement*/}
292+
#### قم بإصلاح جملة return {/*fix-the-return-statement*/}
294293

295-
Something isn't right about this `return` statement. Can you fix it?
294+
هناك شي غير صحيح في جملة`return` هذه. هل يمكنك إصلاحه؟
296295

297296
<Hint>
298297

299-
You may get an "Unexpected token" error while trying to fix this. In that case, check that the semicolon appears *after* the closing parenthesis. Leaving a semicolon inside `return ( )` will cause an error.
298+
قد تحصل على خطأ "Unexpected token" أثناء محاولتك لإصلاح هذا. في هذه الحالة، تحقق من أن الفاصلة المنقوطة تظهر *بعد* قوس الإغلاق. ترك فاصلة منقوطة داخل `return ( )` سيسبب خطأ.
300299

301300
</Hint>
302301

@@ -305,7 +304,7 @@ You may get an "Unexpected token" error while trying to fix this. In that case,
305304
```js
306305
export default function Profile() {
307306
return
308-
<img src="https://i.imgur.com/jA8hHMpm.jpg" alt="Katsuko Saruhashi" />;
307+
<img src="https://i.imgur.com/jA8hHMpm.jpg" alt="كاتسوكو ساروهاشي" />;
309308
}
310309
```
311310

@@ -317,13 +316,13 @@ img { height: 180px; }
317316

318317
<Solution>
319318

320-
You can fix this component by moving the return statement to one line like so:
319+
يمكنك إصلاح هذا المكوّن عن طريق نقل جملة return إلى سطر واحد كما يلي:
321320

322321
<Sandpack>
323322

324323
```js
325324
export default function Profile() {
326-
return <img src="https://i.imgur.com/jA8hHMpm.jpg" alt="Katsuko Saruhashi" />;
325+
return <img src="https://i.imgur.com/jA8hHMpm.jpg" alt="كاتسوكو ساروهاشي" />;
327326
}
328327
```
329328

@@ -333,7 +332,7 @@ img { height: 180px; }
333332

334333
</Sandpack>
335334

336-
Or by wrapping the returned JSX markup in parentheses that open right after `return`:
335+
أو عن طريق إحاطة الترميز المرئي JSX الذي يتم إرجاعه بالأقواس ووضع علامة القوس المفتوحة مباشرة بعد الكلمة `return`.
337336

338337
<Sandpack>
339338

@@ -342,7 +341,7 @@ export default function Profile() {
342341
return (
343342
<img
344343
src="https://i.imgur.com/jA8hHMpm.jpg"
345-
alt="Katsuko Saruhashi"
344+
alt="كاتسوكو ساروهاشي"
346345
/>
347346
);
348347
}
@@ -356,9 +355,9 @@ img { height: 180px; }
356355

357356
</Solution>
358357

359-
#### Spot the mistake {/*spot-the-mistake*/}
358+
#### اكتشف الخطأ {/*spot-the-mistake*/}
360359

361-
Something's wrong with how the `Profile` component is declared and used. Can you spot the mistake? (Try to remember how React distinguishes components from the regular HTML tags!)
360+
هناك خطأ في كيفية تعريف واستخدام المكوّن `Profile`. هل يمكنك اكتشاف الخطأ؟ (حاول تذكر كيف تمّيز React المكوّنات عن وسوم HTML!)
362361

363362
<Sandpack>
364363

@@ -367,15 +366,15 @@ function profile() {
367366
return (
368367
<img
369368
src="https://i.imgur.com/QIrZWGIs.jpg"
370-
alt="Alan L. Hart"
369+
alt="ألان ل. هارت"
371370
/>
372371
);
373372
}
374373

375374
export default function Gallery() {
376375
return (
377376
<section>
378-
<h1>Amazing scientists</h1>
377+
<h1>علماء رائعون</h1>
379378
<profile />
380379
<profile />
381380
<profile />
@@ -392,9 +391,9 @@ img { margin: 0 10px 10px 0; height: 90px; }
392391

393392
<Solution>
394393

395-
React component names must start with a capital letter.
394+
يجب أن تبدأ أسماء مكوّنات React بحرف كبير.
396395

397-
Change `function profile()` to `function Profile()`, and then change every `<profile />` to `<Profile />`:
396+
قم بتغيير `function profile()` إلى`function Profile()`, ثم قم بتغيير كل `<profile />` إلى `<Profile />`:
398397

399398
<Sandpack>
400399

@@ -403,15 +402,15 @@ function Profile() {
403402
return (
404403
<img
405404
src="https://i.imgur.com/QIrZWGIs.jpg"
406-
alt="Alan L. Hart"
405+
alt="ألان ل. هارت"
407406
/>
408407
);
409408
}
410409

411410
export default function Gallery() {
412411
return (
413412
<section>
414-
<h1>Amazing scientists</h1>
413+
<h1>علماء رائعون</h1>
415414
<Profile />
416415
<Profile />
417416
<Profile />
@@ -428,14 +427,14 @@ img { margin: 0 10px 10px 0; }
428427

429428
</Solution>
430429

431-
#### Your own component {/*your-own-component*/}
430+
#### مكوّنك الخاص {/*your-own-component*/}
432431

433-
Write a component from scratch. You can give it any valid name and return any markup. If you're out of ideas, you can write a `Congratulations` component that shows `<h1>Good job!</h1>`. Don't forget to export it!
432+
قم بكتابة مكوّن من الصفر. يمكنك إعطائه أي اسم صالح وإرجاع أي ترميز مرئي. إذا كنت بحاجة إلى أفكار، يمكنك كتابة مكوّن `Congratulations` الذي يعرض `<h1>عمل رائع!</h1>`. لا تنسى تصديره!
434433

435434
<Sandpack>
436435

437436
```js
438-
// Write your component below!
437+
// قم بكتابة مكونك بالأسفل
439438

440439
```
441440

@@ -448,7 +447,7 @@ Write a component from scratch. You can give it any valid name and return any ma
448447
```js
449448
export default function Congratulations() {
450449
return (
451-
<h1>Good job!</h1>
450+
<h1>عمل رائع!</h1>
452451
);
453452
}
454453
```

src/sidebarLearn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"path": "/learn/describing-the-ui",
5353
"routes": [
5454
{
55-
"title": "Your First Component",
55+
"title": "مكوّنك الأول",
5656
"path": "/learn/your-first-component"
5757
},
5858
{

0 commit comments

Comments
 (0)