Skip to content

Commit 75edf51

Browse files
authored
Merge pull request #47 from abdomagdi/hello-world
Translate hello-world
2 parents f987ca8 + 0ae3945 commit 75edf51

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Hello, world!
1+
# أهلاً, بالعالم!
22

3-
This part of the tutorial is about core JavaScript, the language itself.
3+
هذا الجزء من البرنامج التعليمي عن أساسيات لغة الجافا سكريبت، اللغة نفسها.
44

5-
But we need a working environment to run our scripts and, since this book is online, the browser is a good choice. We'll keep the amount of browser-specific commands (like `alert`) to a minimum so that you don't spend time on them if you plan to concentrate on another environment (like Node.js). We'll focus on JavaScript in the browser in the [next part](/ui) of the tutorial.
5+
لكن نحتاج إلى بيئة عمل من أجل تشغيل النصوص الخاصة بنا، وبما أن هذا الكتاب عبر الانترنت، لذافإن المتصفح خيار جيد.سوف نقوم بالاحتفاظ بالأوامر الخاصة بالمتصفح (مثل `alert`) للحد الأدنى بحيث لا تقضي وقتًا عليها إذا كنت تخطط للتركيز على بيئة أخرى (مثل Node.js). سوف نركز على الجافا سكريبت في المتصفح [الجزء التالي](/ui) من البرنامج التعليمي.
66

7-
So first, let's see how we attach a script to a webpage. For server-side environments (like Node.js), you can execute the script with a command like `"node my.js"`.
7+
لذا أولاً, دعونا نرفق نص برمجي في صفحة الويب. بالنسبة للبيئات التي تعمل على الخوادم (مثل Node.js), يمكنك تنفيذها من خلال استخدام أمر مثل `"node my.js"`.
88

99

10-
## The "script" tag
10+
## الوسم "script"
1111

12-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
12+
يمكن وضع برامج الجافاسكريبت في أي جزء في مستند HTML باستخدام وسم`<script>`.
1313

14-
For instance:
14+
على سبيل المثال:
1515

1616
```html run height=100
1717
<!DOCTYPE HTML>
@@ -23,7 +23,7 @@ For instance:
2323

2424
*!*
2525
<script>
26-
alert( 'Hello, world!' );
26+
alert( 'أهلاً, بالعالم!' );
2727
</script>
2828
*/!*
2929

@@ -35,53 +35,53 @@ For instance:
3535
```
3636

3737
```online
38-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
38+
يمكن أن تقوم بتشغيل المثال بالضغط على زر "تشغيل" في الجانب الأيمن العلوي بالمربع الأعلى.
3939
```
4040

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
41+
الوسم `<script>` يحتوي على شفرات جافاسكريبت التي يمكن أن تُنفذ بشكل تلقائي عندما يقوم المتصفح بمعالجة الوسم.
4242

4343

44-
## Modern markup
44+
## الترميز الحديث
4545

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
46+
الوسم `<script>` يحتوي على بعض الخصائص التي نادراً مايتم استخدامها في وقتنا الحاضر، لكن يمكن أن تجدها في الشفرات البرمجية القديمة:
4747

48-
The `type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
49-
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic, we'll talk about modules in another part of the tutorial.
48+
الخاصية `type`: <code>&lt;script <u>type</u>=...&gt;</code>
49+
: معيار HTML القديم, HTML4, يتطلب أن يحتوي وسم script على `type`. عادة ما كان `type="text/javascript"`. لم تعد مطلوبة الآن. وأيضاً,معايير HTML الحديثةغيرت معني هذه الخاصية. والآن، يمكن أن تستخدم لوحدات الجافا سكريبت. لكن هذا الموضوع متقدم، وسنتحدث عن الوحدات في جزءآخر من البرنامج التعليمي.
5050

51-
The `language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
52-
: This attribute was meant to show the language of the script. This attribute no longer makes sense because JavaScript is the default language. There is no need to use it.
51+
الخاصية `language`: <code>&lt;script <u>language</u>=...&gt;</code>
52+
: كان الغرض من استخدام هذه الخاصية هو إظهار لغة النص البرمجي، لم تعد هذه الخاصية منطقية الآن لأن الجافا سكريبت هي اللغة الافتراضية. فليست هناك حاجة لاستخدامها.
5353

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
54+
التعليقات قبل وبعد النصوص البرمجية.
55+
: في الكتب والأدلة القديمة جداً، قد تجد تعليقات داخل وسم `<script>` , مثل هذا:
5656

5757
```html no-beautify
5858
<script type="text/javascript"><!--
5959
...
6060
//--></script>
6161
```
6262

63-
This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
63+
لاستم استخدام هذه الخدعة في الجافاسكريبت الحديثة. تخفي هذه التعليقات شفرات الجافاسكريبت في المتصفحات القديمة التي لاتعرف كيفية عمل معالجة للوسم `<script>. نظراً لأن المتصحات التي تم إصدارها في آخر 15 عاماً لاتوجد فيها هذه المشكلة، فإن هذا النوع من التعليقات يمكن أن يساعدك في تحديد الشفرة القديمة حقاً.
6464

6565

66-
## External scripts
66+
## النصوص البرمجية الخارجية
6767

68-
If we have a lot of JavaScript code, we can put it into a separate file.
68+
إذا كان لدينا عدد كبير من أكواد الجافا سكريبت، فإننا يمكن أن نضعها في ملف منفصل.
6969

70-
Script files are attached to HTML with the `src` attribute:
70+
يتم إرفاق ملفات النصوص البرمجية HTML باستخدام خاصية `src` :
7171

7272
```html
7373
<script src="/path/to/script.js"></script>
7474
```
7575

76-
Here, `/path/to/script.js` is an absolute path to the script from the site root. One can also provide a relative path from the current page. For instance, `src="script.js"` would mean a file `"script.js"` in the current folder.
76+
هنا, `/path/to/script.js` هو مسار منفرد للنص البرمجي من جذر الموقع. يمكن أيضاً توفير مسار نسبي من خلال الصفحة الحالية.. على سبيل المثال، `src="script.js"` تعني أن الملف `"script.js"` في نفس المجلد.
7777

78-
We can give a full URL as well. For instance:
78+
يمكن أن نعطي المسار الكامل أيضاً. على سبيل المثال :
7979

8080
```html
8181
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
8282
```
8383

84-
To attach several scripts, use multiple tags:
84+
لكي نرفق العديد من النصوص البرمجية، استخدم To attach several scripts, use الوسوم بصورة مضاعفة:
8585

8686
```html
8787
<script src="/js/script1.js"></script>
@@ -90,29 +90,29 @@ To attach several scripts, use multiple tags:
9090
```
9191

9292
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
93+
كقاعدة، يتم وضع النصوص البرمجية البسيطة داخل HTML. والنصوص المعقدة يتم وضعها في ملفات منفصلة.
9494
95-
The benefit of a separate file is that the browser will download it and store it in its [cache](https://en.wikipedia.org/wiki/Web_cache).
95+
فائدة الملفات المنفصلة هي أن المتصفح يقوم بتحميلهاوتخزينها في[ذاكرة التخزين المؤقتة](https://en.wikipedia.org/wiki/Web_cache).
9696
97-
Other pages that reference the same script will take it from the cache instead of downloading it, so the file is actually downloaded only once.
97+
الصفحات الأخرى التي تشير إلى نفس النص البرمجي سوف تحصل عليه من ذاكرة التخزين المؤقتة بدلاً من تنزيله، لذا فإن الملف يتم تحميله مرة واحدة.
9898
99-
That reduces traffic and makes pages faster.
99+
هذا يقلل من الحركة ويجعل الصفحات تكون أسرع.
100100
```
101101

102-
````warn header="If `src` is set, the script content is ignored."
103-
A single `<script>` tag can't have both the `src` attribute and code inside.
102+
````warn header="إذا `src` تم تعيين, يتم تجاهل محتوى النص البرمجي."
103+
وسم `<script>` منفرداً لايمكن أن يحتوي على خاصية `src` والكود بداخله.
104104

105-
This won't work:
105+
هذا لايعمل:
106106

107107
```html
108108
<script *!*src*/!*="file.js">
109109
alert(1); // the content is ignored, because src is set
110110
</script>
111111
```
112112

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
113+
يجب اختيار إما خارجي `<script src="…">` أو عادي `<script>` باستخدام الكود.
114114

115-
The example above can be split into two scripts to work:
115+
يمكن تقسيم المثال أعلاه إلى نصين برمجيين لكي يعمل:
116116

117117
```html
118118
<script src="file.js"></script>
@@ -122,11 +122,11 @@ The example above can be split into two scripts to work:
122122
```
123123
````
124124
125-
## Summary
125+
## ملخص
126126
127-
- We can use a `<script>` tag to add JavaScript code to a page.
128-
- The `type` and `language` attributes are not required.
129-
- A script in an external file can be inserted with `<script src="path/to/script.js"></script>`.
127+
- يمكن استخدام وسم `<script>` لإضافة كود الجافا سكريبت إلى صفحة.
128+
- الخصائص `type` و `language` غير مطلوبة.
129+
- يمكن إدراج النص البرمجي في ملف خارجي باستخدام `<script src="path/to/script.js"></script>`.
130130
131131
132-
There is much more to learn about browser scripts and their interaction with the webpage. But let's keep in mind that this part of the tutorial is devoted to the JavaScript language, so we shouldn't distract ourselves with browser-specific implementations of it. We'll be using the browser as a way to run JavaScript, which is very convenient for online reading, but only one of many.
132+
هناك الكثير لتتعلمه عن نصوص المتصفح البرمجية وتفاعلها مع صفحة الويب. ولكن دعنا نضع في اعتبارنا أن هذا الجزء من البرنامج التعليمي مخصص للغة جافا سكريبت ، لذلك لا ينبغي أن نشتت انتباهنا بالتطبيقات الخاصة بالمتصفح. سنستخدم المتصفح كوسيلة لتشغيل جافا سكريبت ، وهو مناسب جدًا للقراءة عبر الإنترنت ، ولكن واحدًا فقط من بين العديد.

0 commit comments

Comments
 (0)