Skip to content

Commit 7cf401e

Browse files
committed
Article translated
1 parent f391af0 commit 7cf401e

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

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

+36-38
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,85 @@
11
# Hello, world!
22

3-
This part of the tutorial is about core JavaScript, the language itself.
3+
ٹیوٹوریل کا یہ حصہ Javascript کی بنیاد ہے۔ Javascript زبان کا سبق ہے یہ۔
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.
6-
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"`.
5+
لیکن ہمیں اپنی سکرپٹس چلانے کیلیے کسی انوائرنمنٹ کی ضرورت ہے۔ چونکہ یہ کتاب آن لائن ہے تو براؤزر ہی ایک اچھا انتخاب ہے۔ ہم براؤزر کے متعلق کمانڈز (جیسے کہ `alert` ہے) کو کم سے کم استعمال کریں گے تاکہ اگر آپ کسی دوسرے انوائرنمنٹ جیسے (Node JS ہے) پر کام کرنا چاہیں تو آپ کو بہت زیادہ مشکل نہ ہو۔ ہم [اگلے حصے](/ui) میں Javascript کو براؤزر میں استعمال کرنے پر غور کریں گے۔
86

7+
تو پہلے دیکھتے ہیں کہ ایک سکرپٹ کو ایک ویب پیج کے ساتھ کیسے جوڑا جاتا ہے۔ server-side انوائرنمنٹ (جیسے Node ہے) پر سکرپٹ چلانے کیلیے ایک کمانڈ جیسے `"node my.js"` ہے کو چلایا جائے گا۔
98

109
## The "script" tag
1110

12-
JavaScript programs can be inserted almost anywhere into an HTML document using the `<script>` tag.
11+
جاواسکرپٹ (Javascript) پروگرامز کو HTML ڈاکیومنٹ میں کہیں بھی `<script>` tag شاھل کیا جا سکتا ہے۔
1312

14-
For instance:
13+
مثال کے طور پر:
1514

1615
```html run height=100
1716
<!DOCTYPE HTML>
1817
<html>
1918

2019
<body>
2120

22-
<p>Before the script...</p>
21+
<p>سکرپٹ سے پہلے۔۔۔</p>
2322

2423
*!*
2524
<script>
2625
alert( 'Hello, world!' );
2726
</script>
2827
*/!*
2928

30-
<p>...After the script.</p>
29+
<p>سکرپٹ کے بعد۔۔۔</p>
3130

3231
</body>
3332

3433
</html>
3534
```
3635

3736
```online
38-
You can run the example by clicking the "Play" button in the right-top corner of the box above.
37+
آپ مثال کو چلانے کیلیے ڈبے کے سب سے اوپر دائیں کونے میں "Play" کے بٹن کو دبا سکتے ہیں۔
3938
```
4039

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
42-
40+
`<script>` tag میں موجود Javascript کوڈ براؤزر کے tag کو پروسیس کرنے پر خود بخود چل جاتا ہے۔
4341

4442
## Modern markup
4543

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
44+
`<script>` tag کے کچھ attributes ہیں جو آج کل مشکل ہی استعمال کیجیے جاتے ہیں لیکن پرانے کوڈ میں ابھی بھی موجود ہیں:
45+
46+
`type` attribute: <code>&lt;script <u>type</u>=...&gt;</code>
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+
: پرانے HTML standard, HTML4 میں سکرپٹ tag کے اوپر `type` attribute کا ہونا لازمی تھا۔ عام طور پر یہ `type="text/javascript"` ہوتا تھا۔ اب یہ لازم نہیں ہے۔ جدید HTML standard نے اسکا مطلب بھی بدل دیا ہے۔ اب یہ Javascript موڈیولز کیلیے استعمال ہو سکتا ہے۔ لیکن وہ ایک اعلی درجے کا موضوع ہے۔ ہم اس کے بارے ٹیوٹوریل کے موڈیولز کے حصے میں بات کریں گے۔
5049

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.
50+
`language` attribute: <code>&lt;script <u>language</u>=...&gt;</code>
51+
: یہ attribute سکرپٹ کی زبان دکھانے کیلیے استعمال ہوتا تھا۔ اب یہ attribute کسی کام کا نہیں کیونکہ Javascript ڈیفالٹ زبان ہے۔ اسے استعمال کرنے کی کوئی ضرورت نہیں۔
5352

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
53+
سکرپٹس کے پہلے اور بعد میں کمنٹس۔
54+
: پرانی کتابوں اور گائیڈز میں آپ کو `<script>` tags میں اس طرح کمنٹ ملتے ہوں گے:
5655

5756
```html no-beautify
5857
<script type="text/javascript"><!--
5958
...
6059
//--></script>
6160
```
62-
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.
61+
یہ طریقہ جدید Javascript میں استعمال نہیں کیا جاتا۔ یہ کمنٹس Javascript کوڈ کو پرابے براؤزرز جنہیں یہ معلوم نہیں کہ `<script>` tag کو کس طرح پروسیس کرنا ہے سے چھپا دیتے ہیں۔ چونکہ پچھلے 15 سالوں میں جو براؤزرز ریلیز کیے جا رہے ہیں ان میں یہ مسؑلہ نہیں اس کمنٹ سے آپ کے ایک بہت پرانے کوڈ کی شناخت کرنے میں مدد ملے گی۔
6462

6563

6664
## External scripts
6765

68-
If we have a lot of JavaScript code, we can put it into a separate file.
66+
اگر ہمارے پاس بہت زیادہ جاواسکرپٹ کوڈ ہو تو ہم اسے علیحدہ فائل میں شامل کر سکتے ہیں۔
6967

70-
Script files are attached to HTML with the `src` attribute:
68+
سکرپٹ فائلز کو HTML کے ساتھ `src` attribute سے جوڑا جاتا ہے۔
7169

7270
```html
7371
<script src="/path/to/script.js"></script>
7472
```
7573

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.
74+
یہاں `/path/to/script.js` سکرپٹ کا سائٹ کے روٹ سے ایبسولیوٹ پاتھ ہے۔ ہم موجودہ پیج سے ریلیٹِو پاتھ بھی مہیا کر سکتے ہیں۔ مثال کے طور پر، `src="script.js"`، اسی طرح `src="./script.js"` کا مطلب بھی یہ ہی ہے کہ موجودہ فولڈر میں موجود `"script.js"` نام کی فائل۔
7775

78-
We can give a full URL as well. For instance:
76+
ہم ایک مکمل URL بھی دے سکتے ہیں۔ مثال کے طور پر:
7977

8078
```html
8179
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
8280
```
8381

84-
To attach several scripts, use multiple tags:
82+
کئی سکرپٹس شامل کرنے کیلیے ایک سے زیادہ tags استعمال کیے جاتے ہیں:
8583

8684
```html
8785
<script src="/js/script1.js"></script>
@@ -90,29 +88,29 @@ To attach several scripts, use multiple tags:
9088
```
9189

9290
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
91+
اصول کے مطابق، صرف سادہ ترین سکرپٹس ہی HTML میں لکھی جاتی ہے۔ زیادہ پیچیدہ سکرپٹس کو علیحدہ فائلز میں رکھا جاتا ہے۔
9492
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).
93+
علیحدہ فائل کا فائدہ یہ ہے کہ براؤزر اسے ڈاؤن لوڈ کرنے کے بعد اپنے [cache](https://en.wikipedia.org/wiki/Web_cache) میں محفوظ کر لے گا۔
9694
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.
95+
دوسرے پیجز جو اسی سکرپٹ کو حوالہ استعمال کریں گے وہ اسے ڈاؤن لوڈ کرنے کی جگہ کیش سے اٹھائیں گے۔ اس طرح فائل صرف ایک دفعہ ہی ڈاؤن لوڈ ہوتی ہے اور اسی فائل کا استعمال بار بار ہوتا ہے۔
9896
99-
That reduces traffic and makes pages faster.
97+
اس سے ٹریفک کم ہوتی ہے اور پیج تیز ہو جاتا ہے۔
10098
```
10199

102100
````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.
101+
ایک اکیلا `<script>` tag اپنے اندر کوڈ اور `src` attribute دونوں نہیں رکھ سکتا۔
104102

105-
This won't work:
103+
یہ کوڈ کام نہیں کرے گا:
106104

107105
```html
108106
<script *!*src*/!*="file.js">
109-
alert(1); // the content is ignored, because src is set
107+
alert(1); // کنٹینٹ اگنور کر دیا جاتا ہے، کیونکہ سورس موجود ہے۔
110108
</script>
111109
```
112110

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
111+
ہمیں بیرونی `<script src"...">` یا اندرونی `<script>` سکرپٹ میں سے کوئی ایک لازمی چننا ہوتی ہے۔
114112

115-
The example above can be split into two scripts to work:
113+
مندرجہ بالا مثال کو دو سکرپٹس میں تقسیم کر کے استعمال کیا جا سکتا ہے:
116114

117115
```html
118116
<script src="file.js"></script>
@@ -123,10 +121,10 @@ The example above can be split into two scripts to work:
123121
````
124122
125123
## Summary
124+
- ہم `<script>` tag استعمال کرکے Javascript کوڈ کو پیج میں شامل کر سکتے ہیں۔
125+
- `type` اور `language` attributes لازم نہیں۔
126+
- بیرونی سکرپٹ کو `<script src="path/to/script.js"></script>` کی مدد سے شامل کیا جا سکتا ہے۔
126127
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>`.
130-
128+
براؤزر سکرپٹس کے بارے اور ان کی ویب پیج کے ساتھ interaction کے بارے بہت کچھ سیکھنے کو ہے۔ لیکن ذہن نشین رکھیے کہ ٹیوٹوریل کا یہ حصہ Javascript زبان کیلیے مخصوص ہے۔
131129
132130
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)