Skip to content

Commit c2f7c0d

Browse files
authored
Merge pull request #10 from rojcode/master
Translate Hello,World
2 parents 89775d7 + cd055f4 commit c2f7c0d

File tree

1 file changed

+48
-41
lines changed

1 file changed

+48
-41
lines changed

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
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) ئەم فێرکارییە سەبارەت بە Node.js نییە بەڵام فێربوونی بناغە و بنچینەکانی خودێ جاڤاسکڕێپت بەدڵنیایەو یارمەتی دەریی تۆ دەبێ لە داهاتوو ئەگەر ویستت Node.js فێربیت. ئێمە لە فێرکاری [داهاتوو](/ui) دا سەرنج قووڵتر دەخەینە سەر جاڤاسکڕێپت لە وێبگەڕەکانە. کەواتە سەرەتا با بزانین چۆن سکریپتێک بە لاپەرێکی وێبەو هاوپێچ بکەین. بۆ ژینگەکانی لای سێرڤەر (وەک Node.js)، دەتوانیت سکریپتەکە بە فەرمانێکی وەک `node my.js` جێبەجێ بکەیت.
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"`.
87

98

10-
## The "script" tag
9+
## تەگ ئێسکریپت
1110

12-
JavaScript programs can be inserted almost anywhere into an HTML document using the `<script>` tag.
13-
14-
For instance:
11+
دەتوانرێت بەرنامەکانی جاڤاسکڕێپت لە نزیکەی هەر شوێنێکی بەڵگەنامەیەکی HTML دا بە بەکارهێنانی تاگی `<script>` دابنرێت.
1512

1613
```html run height=100
1714
<!DOCTYPE HTML>
@@ -23,7 +20,7 @@ For instance:
2320

2421
*!*
2522
<script>
26-
alert( 'Hello, world!' );
23+
alert( 'سڵاو ، جیهان' );
2724
</script>
2825
*/!*
2926

@@ -35,53 +32,58 @@ For instance:
3532
```
3633

3734
```online
38-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
35+
دەتوانیت نموونەکە بەڕێوەببەیت بە کرتەکردن لەسەر دوگمەی "Play" لە گۆشەی سەرەوەی لای ڕاستی بۆکسەکەی سەرەوە.
3936
```
4037

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
38+
تاگی `<script>` کۆدی جاڤاسکڕێپتی تێدایە کە بە شێوەیەکی ئۆتۆماتیکی جێبەجێ دەکرێت کاتێک وێبگەڕ تاگەکە پرۆسێس دەکات.
39+
40+
41+
## نووسینی مۆدێرن
42+
43+
تاگی `<script>` چەند تایبەتمەندییەکی هەیە کە ئەمڕۆ بە دەگمەن بەکاردەهێنرێن، بەڵام هێشتا لە کۆدی کۆنتردا دەبینرێن
44+
45+
تایبەتمەندی `جۆر`: <code>&lt;script <u>type</u>=...&gt;</code>
46+
47+
: ستانداردە کۆنەکەی HTML، HTML4، پێویستی بە سکریپتێک هەبوو کە `جۆر`ی هەبێت. بەزۆری `type="text/javascript` بوو. ئیتر پێویست ناکات.هەروەها ستانداردی مۆدێرن HTML مانای ئەم تایبەتمەندییەی بەتەواوەتی گۆڕی. ئێستا دەتوانرێت بۆ مۆدیولەکانی جاڤاسکڕێپت بەکاربهێنرێت. بەڵام ئەمە بابەتێکی پێشکەوتووە، لە بەشێکی تری فێرکاریەکەدا باسی مۆدیولەکان دەکەین.
4248

49+
تایبەتمەندی `زمان`: <code>&lt;script <u>language</u>=...&gt;</code>
4350

44-
## Modern markup
51+
: ئەم تایبەتمەندییە بۆ پیشاندانی زمانی سکریپت بوو. ئەم تایبەتمەندییە چیتر مانای نییە چونکە جاڤاسکڕێپت زمانی پێشوەختەیە. پێویست بە بەکارهێنانی ناکات.
4552

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
4753

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.
54+
کۆمێنتەکانی پێش و دوای سکڕێپتەکە.
5055

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.
5356

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
57+
: لە کتێب و دەستنووسی بەڕاستی کۆنەکاندا، ڕەنگە کۆمێنتەکان لەناو تاگەکانی `<script>`دا بدۆزیتەوە، بەم شێوەیە:
5658

5759
```html no-beautify
5860
<script type="text/javascript"><!--
5961
...
6062
//--></script>
6163
```
6264

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.
65+
ئەم فێڵە لە جاڤاسکڕێپتی مۆدێرن بەکارناهێنرێت. ئەم کۆمێنتانە کۆدی جاڤاسکڕێپت لە وێبگەڕە کۆنەکان دەشارنەوە کە نەیاندەزانی چۆن تاگی `<script> `پرۆسێس بکەن. بەو پێیەی ئەو وێبگەڕانەی لە ١٥ ساڵی ڕابردوودا بڵاوکراونەتەوە ئەم کێشەیەیان نییە، ئەم جۆرە کۆمێنتە دەتوانێت یارمەتیت بدات بۆ ناسینەوەی کۆدی بەڕاستی کۆن.
6466

6567

66-
## External scripts
68+
## سکریپتە دەرەکییەکان
6769

68-
If we have a lot of JavaScript code, we can put it into a separate file.
70+
ئەگەر کۆدی جاڤاسکڕێپتێکی زۆرمان هەبێت دەتوانین بیخەینە فایلێکی جیا.
6971

70-
Script files are attached to HTML with the `src` attribute:
72+
فایلەکانی سکریپت بە تایبەتمەندی `src` دەخرێنە پاڵ HTML:
7173

7274
```html
7375
<script src="/path/to/script.js"></script>
7476
```
7577

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"`, just like `src="./script.js"`, would mean a file `"script.js"` in the current folder.
78+
لێرەدا، `/path/to/script.js` ڕێڕەوێکی ڕەهایە بۆ سکریپتەکە لە ڕەگی ماڵپەڕەکەوە. هەروەها دەتوانرێت ڕێڕەوێکی ڕێژەیی لە لاپەڕەی ئێستاوە دابین بکرێت. بۆ نموونە، `src="script.js"`، هەروەک چۆن `src="./script.js"`، بە واتای پەڕگەی `script.js` لە فۆلدری ئێستادا.
7779

78-
We can give a full URL as well. For instance:
80+
هەروەها دەتوانین URL ێکی تەواو بدەین. بۆ نموونە:
7981

8082
```html
8183
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
8284
```
8385

84-
To attach several scripts, use multiple tags:
86+
بۆ هاوپێچکردنی چەندین سکریپت، چەندین تاگ بەکاربهێنە:
8587

8688
```html
8789
<script src="/js/script1.js"></script>
@@ -90,29 +92,31 @@ To attach several scripts, use multiple tags:
9092
```
9193

9294
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
95+
وەک یاسایەک تەنها سادەترین سکریپتەکان لە HTML دادەنرێت. ئەوانەی ئاڵۆزترن لە فایلە جیاوازەکاندان.
9496
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).
97+
سوودی فایلێکی جیا ئەوەیە کە وێبگەڕەکە دایبەزێنێت و لە [کەش](https://en.wikipedia.org/wiki/Web_cache)ى خۆیدا هەڵیدەگرێت.
9698
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.
99+
لاپەڕەکانی تر کە ئاماژە بە هەمان سکریپت دەکەن لەبری دابەزاندنی لە کاشەوە دەیهێنن، بۆیە لە ڕاستیدا فایلەکە تەنها یەکجار دابەزێنرێت.
100+
101+
کە ترافیکی کەم دەکاتەوە و پەیجەکان خێراتر دەکات.
98102
99-
That reduces traffic and makes pages faster.
100103
```
101104

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.
105+
````نوکتە:warn header="ئەگەر `src` دانرابێت، ناوەڕۆکی سکریپت پشتگوێ دەخرێت."
106+
107+
تاگی `<script>` ناتوانێت هەم تایبەتمەندی "src" و هەم کۆدی ناوەوەی هەبێت.
104108

105-
This won't work:
109+
ئەمەش کار ناکات:
106110

107111
```html
108112
<script *!*src*/!*="file.js">
109-
alert(1); // the content is ignored, because src is set
113+
alert(1); // ناوەڕۆک پشتگوێ دەخرێت چونکە src دانراوە
110114
</script>
111115
```
112116

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
117+
دەبێت `<script src="...”>` دەرەکی یان `<script>` ی ئاسایی بە کۆدەوە هەڵبژێرین.
114118

115-
The example above can be split into two scripts to work:
119+
نموونەی سەرەوە دەتوانرێت دابەش بکرێت بۆ دوو سکریپت بۆ کارکردن لەگەڵی:
116120

117121
```html
118122
<script src="file.js"></script>
@@ -122,11 +126,14 @@ The example above can be split into two scripts to work:
122126
```
123127
````
124128
125-
## Summary
129+
## پوختە
130+
131+
- دەتوانین تاگی "<script>" بەکاربهێنین بۆ زیادکردنی کۆدی جاڤاسکڕێپت بۆ لاپەڕەکە.
132+
133+
- سیفاتەکانی `جۆر` و `زمان` پێویست نین.
134+
135+
- دەتوانرێت سکریپتێک لە پەڕگەیەکی دەرەکیدا لەگەڵ "<script src="path/to/script.js"></script>"دا جێگیر بکرێت.
126136
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>`.
130137
138+
زۆر شتی تر هەیە بۆ فێربوون دەربارەی سکریپتەکانی وێبگەڕ و کارلێککردنیان لەگەڵ وێب پەیجێک. بەڵام با ئەوەمان لەبەرچاو بێت کە ئەم بەشەی فێرکارییەکە تایبەتە بە زمانی جاڤاسکڕێپت، بۆیە نابێت گیرۆدەی جێبەجێکردنی تایبەت بە وێبگەڕ بین. ئێمە وێبگەڕەکە وەک ڕێگەیەک بۆ بەڕێوەبردنی جاڤاسکڕێپت بەکاردەهێنین کە فێربوونی ئاسانە، بەڵام تەنها یەکێکە لە چەندین ڕێگا.
131139
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.

0 commit comments

Comments
 (0)