Skip to content

Commit e259d15

Browse files
committed
Translate 'Declaring a winner'
1 parent 1e2bcd7 commit e259d15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/learn/tutorial-tic-tac-toe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ body {
15241524
15251525
### Voittajan päättäminen {/*declaring-a-winner*/}
15261526
1527-
Now that the players can take turns, you'll want to show when the game is won and there are no more turns to make. To do this you'll add a helper function called `calculateWinner` that takes an array of 9 squares, checks for a winner and returns `'X'`, `'O'`, or `null` as appropriate. Don't worry too much about the `calculateWinner` function; it's not specific to React:
1527+
Nyt kun pelaajat voivat ottaa vuoroja, haluat näyttää kun peli on voitettu ja ei ole enää vuoroja tehtävänä. Tämän tekemiseksi lisäät apufunktion nimeltä `calculateWinner`, joka ottaa yhdeksän neliön taulukon, tarkistaa onko voittaja ja palauttaa `'X'`, `'O'`, tai `null` tarvittaessa. Älä huoli liikaa `calculateWinner` funktiosta; se ei ole Reactiin erityinen:
15281528
15291529
```js App.js
15301530
export default function Board() {
@@ -1554,11 +1554,11 @@ function calculateWinner(squares) {
15541554
15551555
<Note>
15561556
1557-
It does not matter whether you define `calculateWinner` before or after the `Board`. Let's put it at the end so that you don't have to scroll past it every time you edit your components.
1557+
Ei ole väliä määritteletkö `calculateWinner` ennen vai jälkeen `Board`:n. Laitetaan se loppuun, jotta sinun ei tarvitse selata sen ohi joka kerta kun muokkaat komponenttejasi.
15581558
15591559
</Note>
15601560
1561-
You will call `calculateWinner(squares)` in the `Board` component's `handleClick` function to check if a player has won. You can perform this check at the same time you check if a user has clicked a square that already has a `X` or and `O`. We'd like to return early in both cases:
1561+
Kutsut `calculateWinner(squares)` `Board` komponentin `handleClick` funktiossa tarkistaaksesi onko pelaaja voittanut. Voit suorittaa tämän tarkistuksen samaan aikaan kun tarkistat onko käyttäjä klikannut neliötä, jossa on jo `X` tai `O`. Haluamme palata aikaisin molemmissa tapauksissa:
15621562
15631563
```js {2}
15641564
function handleClick(i) {
@@ -1570,7 +1570,7 @@ function handleClick(i) {
15701570
}
15711571
```
15721572
1573-
To let the players know when the game is over, you can display text such as "Winner: X" or "Winner: O". To do that you'll add a `status` section to the `Board` component. The status will display the winner if the game is over and if the game is ongoing you'll display which player's turn is next:
1573+
Antaaksesi pelaajiesi tietää milloin peli on ohi, voit näyttää tekstin kuten "Winner: X" tai "Winner: 0". Tämän tekemiseksi lisäät `status` osion `Board` komponenttiin. Status näyttää voittajan, jos peli on ohi ja jos peli on kesken, näytät kumman pelaajan vuoro on seuraavaksi:
15741574
15751575
```js {3-9,13}
15761576
export default function Board() {
@@ -1592,7 +1592,7 @@ export default function Board() {
15921592
}
15931593
```
15941594
1595-
Congratulations! You now have a working tic-tac-toe game. And you've just learned the basics of React too. So _you_ are the real winner here. Here is what the code should look like:
1595+
Onneksi olkoon! Sinulla on nyt toimi ristinolla-peli. Ja olet juuri oppinut Reactin perusteet. Joten *sinä* olet oikea voittaja tässä. Tässä on miltä koodisi tulisi näyttää:
15961596
15971597
<Sandpack>
15981598

0 commit comments

Comments
 (0)