Skip to content

Commit 4359a36

Browse files
authored
Translate 'Hello, world!' page (#16)
1 parent 0b28115 commit 4359a36

File tree

6 files changed

+56
-58
lines changed

6 files changed

+56
-58
lines changed

Diff for: 1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<body>
55

66
<script>
7-
alert( "I'm JavaScript!" );
7+
alert( "Jestem JavaScript!" );
88
</script>
99

1010
</body>

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ importance: 5
22

33
---
44

5-
# Show an alert
5+
# Wyświetl komunikat
66

7-
Create a page that shows a message "I'm JavaScript!".
7+
Stwórz stronę, która wyświetla komunikat "Jestem JavaScript!".
88

9-
Do it in a sandbox, or on your hard drive, doesn't matter, just ensure that it works.
9+
Nie ważne, czy stworzysz ją w sandboxie, czy lokalnie na dysku - ważne, żeby działała.
1010

1111
[demo src="solution"]
1212

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
alert("I'm JavaScript!");
1+
alert("Jestem JavaScript!");
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
The HTML code:
1+
Kod HTML:
22

33
[html src="index.html"]
44

5-
For the file `alert.js` in the same folder:
5+
Dla pliku `alert.js` znajdującego się w tym samym folderze:
66

77
[js src="alert.js"]
88

Diff for: 1-js/02-first-steps/01-hello-world/2-hello-alert-ext/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ importance: 5
22

33
---
44

5-
# Show an alert with an external script
5+
# Wyświetl komunikat przy użyciu zewnętrznego skryptu
66

7-
Take the solution of the previous task <info:task/hello-alert>. Modify it by extracting the script content into an external file `alert.js`, residing in the same folder.
7+
Pobierz rozwiązanie z poprzedniego zadania pt. "<info:task/hello-alert>". Przenieś zawartość skryptu do osobnego pliku `alert.js` i umieść go w tym samym folderze.
88

9-
Open the page, ensure that the alert works.
9+
Otwórz stronę w przeglądarce i upewnij się, że komunikat wyświetla się poprawnie.

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

+46-48
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,130 @@
1-
# Hello, world!
1+
# Witaj, świecie!
22

3-
This part of the tutorial is about core JavaScript, the language itself.
3+
Ta część samouczka dotyczy głównych funkcjonalności samego języka 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.
5+
Zanim jednak będziemy w stanie uruchamiać nasze skrypty, potrzebujemy środowiska do pracy. Skoro czytasz tę książkę online, idealnie do tego nada się twoja przeglądarka. Ograniczymy komendy przeglądarkowe (np. `alert`) do minimum, aby oszczędzić ci czasu na ich naukę, jeśli planujesz skoncentrować się na innym środowisku (jak np. Node.js). JavaScript działający w przeglądarce omówimy w [następnej części](/ui) tego samouczka.
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+
Na początek zobaczmy, jak podpiąć skrypt do naszej strony. W środowiskach serwerowych (np. Node.js) skrypty wykonuje się poprzez komendę, np. `"node moj_skrypt.js"`.
88

99

10-
## The "script" tag
10+
## Znacznik "script"
1111

12-
JavaScript programs can be inserted into any part of an HTML document with the help of the `<script>` tag.
12+
Programy napisane w JavaScripcie można wrzucić do dowolnej części dokumentu HTML za pomocą znacznika `<script>`.
1313

14-
For instance:
14+
Na przykład:
1515

1616
```html run height=100
1717
<!DOCTYPE HTML>
1818
<html>
1919

2020
<body>
2121

22-
<p>Before the script...</p>
22+
<p>Kod przed skryptem...</p>
2323

2424
*!*
2525
<script>
26-
alert( 'Hello, world!' );
26+
alert( 'Witaj, świecie!' );
2727
</script>
2828
*/!*
2929

30-
<p>...After the script.</p>
30+
<p>... i za skryptem.</p>
3131

3232
</body>
3333

3434
</html>
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+
Aby uruchomić przykład, kliknij na przycisk "Play" w prawym górnym rogu.
3939
```
4040

41-
The `<script>` tag contains JavaScript code which is automatically executed when the browser processes the tag.
41+
Znacznik `<script>` zawiera kod javascriptowy, który jest automatycznie wywoływany, kiedy przeglądarka przetwarza jego zawartość.
4242

4343

44-
## Modern markup
44+
## Nowoczesna składnia
4545

46-
The `<script>` tag has a few attributes that are rarely used nowadays but can still be found in old code:
46+
Znacznik `<script>` posiada kilka atrybutów, których współcześnie się nie używa, a na które można się natknąć w starym kodzie:
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+
Atrybut `type`: <code>&lt;script <u>type</u>=...&gt;</code>
49+
: Stary standard HTML, czyli HTML4, wymagał, aby skrypty miały określony typ (`type`). Zwykle było to `type="text/javascript"`. Obecnie nie jest on już wymagany. Ponadto, w aktualnym standardzie HTML całkowicie zmieniło się jego znaczenie - teraz stosuje się go przy modułach javascriptowych. Ale to zaawansowany temat. O modułach będziemy mówić w innej części samouczka.
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+
Atrybut `language`: <code>&lt;script <u>language</u>=...&gt;</code>
52+
: Ten atrybut służył do określenia języka skryptu. Obecnie nie ma on większego sensu, ponieważ JavaScript jest domyślnym językiem. Nie trzeba go używać.
5353

54-
Comments before and after scripts.
55-
: In really ancient books and guides, you may find comments inside `<script>` tags, like this:
54+
Komentarze przed i za skryptem
55+
: W pradawnych książkach i poradnikach możesz natknąć się na komentarze wewnątrz znacznika `<script>`, takie jak ten:
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+
W nowoczesnym JavaScripcie nie stosuje się już tego triku. Służył on do ukrywania kodu JavaScript przed przeglądarkami, które nie umiały przetwarzać znacznika `<script>`. Jednak z racji tego, że wszystkie przeglądarki z ostatnich 15 lat nie mają już tego problemu, taki komentarz pomoże ci jedynie rozpoznać bardzo, bardzo stary kod.
6464

6565

66-
## External scripts
66+
## Zewnętrzne skrypty
6767

68-
If we have a lot of JavaScript code, we can put it into a separate file.
68+
Kiedy kod skryptu nam się rozrośnie, możemy go umieścić w osobnym pliku.
6969

70-
Script files are attached to HTML with the `src` attribute:
70+
Pliki skryptowe dołącza się do HTML-a za pomocą atrybutu `src`:
7171

7272
```html
73-
<script src="/path/to/script.js"></script>
73+
<script src="/ścieżka/do/skryptu.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+
W tym przykładzie `/ścieżka/do/skryptu.js` to ścieżka bezwzględna do pliku, licząc od katalogu głównego strony. Można jednak podać ścieżkę względną, liczoną od położenia aktualnej strony. Na przykład, `src="skrypt.js"` odnosi się do pliku `"skrypt.js"` w tym samym folderze.
7777

78-
We can give a full URL as well. For instance:
78+
Oprócz tego mamy możliwość podania pełnego adresu URL, na przykład:
7979

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

84-
To attach several scripts, use multiple tags:
84+
Jeśli chcesz dodać kilka skryptów, wstaw więcej znaczników:
8585

8686
```html
87-
<script src="/js/script1.js"></script>
88-
<script src="/js/script2.js"></script>
87+
<script src="/js/skrypt1.js"></script>
88+
<script src="/js/skrypt2.js"></script>
8989
9090
```
9191

9292
```smart
93-
As a rule, only the simplest scripts are put into HTML. More complex ones reside in separate files.
93+
Kieruj się zasadą, że tylko proste i krótkie skrypty powinny trafić bezpośrednio do pliku HTML. Te bardziej skomplikowane należy wydzielać do osobnych plików.
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+
Korzyścią z takiego podejścia jest fakt, że przeglądarka pobierze ten plik i zapisze w swojej [pamięci podręcznej](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.
98-
99-
That reduces traffic and makes pages faster.
97+
Inne strony, które również korzystają z tego samego pliku, wczytają go z pamięci podręcznej, zamiast ponownie go pobierać. Dzięki temu plik ze skryptem jest pobierany tylko raz. Zmniejsza to zużycie łącza i przyspiesza wczytywanie strony.
10098
```
10199

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.
100+
````warn header="Jeśli znacznik ma ustawiony atrybut `src`, jego zawartość jest ignorowana."
101+
Pojedynczy znacznik `<script>` nie może mieć jednocześnie atrybutu `src` i kodu wewnątrz znacznika.
104102

105-
This won't work:
103+
Taki kod nie zadziała:
106104

107105
```html
108-
<script *!*src*/!*="file.js">
109-
alert(1); // the content is ignored, because src is set
106+
<script *!*src*/!*="plik.js">
107+
alert(1); // ten kod jest ignorowany, bo ustawiono 'src'
110108
</script>
111109
```
112110

113-
We must choose either an external `<script src="…">` or a regular `<script>` with code.
111+
Musimy wybrać, czy chcemy wczytać zewnętrzny skrypt za pomocą `<script src="…">`, czy wykonać kod zawarty wewnątrz `<script>`.
114112

115-
The example above can be split into two scripts to work:
113+
Powyższy przykład można rozbić na dwa skrypty:
116114

117115
```html
118-
<script src="file.js"></script>
116+
<script src="plik.js"></script>
119117
<script>
120118
alert(1);
121119
</script>
122120
```
123121
````
124122
125-
## Summary
123+
## Podsumowanie
126124
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>`.
125+
- Znacznik `<script>` służy do dodawania kodu javascriptowego do strony.
126+
- Atrybuty `type` i `language` nie są wymagane.
127+
- Zewnętrzny skrypt z pliku wczytujemy za pomocą `<script src="ścieżka/do/skryptu.js"></script>`.
130128
131129
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.
130+
To tylko wierzchołek góry lodowej, jeśli chodzi o skrypty przeglądarkowe i ich interakcje ze stroną. Pamiętajmy jednak, że ta część samouczka jest poświęcona językowi JavaScript, dlatego nie powinniśmy mieszać sobie w głowach implementacjami właściwymi tylko dla przeglądarek. Do uruchamiania kodu javascriptowego będziemy używać przeglądarki, co jest wygodne podczas czytania online, ale to tylko jeden z wielu sposobów.

0 commit comments

Comments
 (0)