From 17b6a84b3da3bcdb79d6da146c973d11009b89ee Mon Sep 17 00:00:00 2001 From: Keramas Wiguna Date: Thu, 1 Oct 2020 09:47:05 +0800 Subject: [PATCH] Translate page tutorial/logic --- .../content/tutorial/04-logic/01-if-blocks/text.md | 8 ++++---- .../content/tutorial/04-logic/02-else-blocks/text.md | 6 +++--- .../tutorial/04-logic/03-else-if-blocks/text.md | 6 +++--- .../content/tutorial/04-logic/04-each-blocks/text.md | 9 +++++---- .../tutorial/04-logic/05-keyed-each-blocks/text.md | 12 ++++++------ .../tutorial/04-logic/06-await-blocks/text.md | 10 +++++----- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/01-if-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/01-if-blocks/text.md index 3391507..963c1a4 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/01-if-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/01-if-blocks/text.md @@ -1,10 +1,10 @@ --- -title: If blocks +title: Blok if --- -HTML doesn't have a way of expressing *logic*, like conditionals and loops. Svelte does. +HTML tidak mempunyai cara untuk mengekspresikan *logika*, seperti kondisi dan perulangan. Svelte punya. -To conditionally render some markup, we wrap it in an `if` block: +Untuk mengkondisikan *render* markup, kita membungkusnya dengan `if` blok: ```html {#if user.loggedIn} @@ -20,4 +20,4 @@ To conditionally render some markup, we wrap it in an `if` block: {/if} ``` -Try it — update the component, and click on the buttons. \ No newline at end of file +Cobalah - perbarui komponen, dan klik tombolnya. diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/02-else-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/02-else-blocks/text.md index d25a7d3..78b7404 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/02-else-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/02-else-blocks/text.md @@ -1,8 +1,8 @@ --- -title: Else blocks +title: Blok else --- -Since the two conditions — `if user.loggedIn` and `if !user.loggedIn` — are mutually exclusive, we can simplify this component slightly by using an `else` block: +Adanya dua kondisi - `if user.loggedIn` dan `if !user.loggedIn` - dimana itu eksklusif, kita bisa menyederhanakan komponen dengan menggunakan `else` blok: ```html {#if user.loggedIn} @@ -16,4 +16,4 @@ Since the two conditions — `if user.loggedIn` and `if !user.loggedIn` — are {/if} ``` -> A `#` character always indicates a *block opening* tag. A `/` character always indicates a *block closing* tag. A `:` character, as in `{:else}`, indicates a *block continuation* tag. Don't worry — you've already learned almost all the syntax Svelte adds to HTML. \ No newline at end of file +> Karakter `#` selalu menunjukkan sebuah tag *pembukaan blok*. Karakter `/` selalu menunjukan sebuah tag *penutup blok*. Karakter `:`, dalam `{:else}`, menunjukkan sebuah tag *lanjutan blok*. Jangan khawatir - kamu sudah mempelajari hampir semua sintak yang Svelte tambahkan ke HTML. diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/03-else-if-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/03-else-if-blocks/text.md index 18faeac..3d0e138 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/03-else-if-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/03-else-if-blocks/text.md @@ -1,8 +1,8 @@ --- -title: Else-if blocks +title: Blok else-if --- -Multiple conditions can be 'chained' together with `else if`: +Banyak kondisi dapat 'dirangkai' secara bersamaan dengan `else if`: ```html {#if x > 10} @@ -12,4 +12,4 @@ Multiple conditions can be 'chained' together with `else if`: {:else}

{x} is between 5 and 10

{/if} -``` \ No newline at end of file +``` diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/04-each-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/04-each-blocks/text.md index 886990f..8932609 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/04-each-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/04-each-blocks/text.md @@ -1,8 +1,8 @@ --- -title: Each blocks +title: Blok each --- -If you need to loop over lists of data, use an `each` block: +Jika kamu perlu melakukan perulangan dari sebuah *list* data, gunakanlah `each` blok: ```html ``` -> The expression (`cats`, in this case) can be any array or array-like object (i.e. it has a `length` property). You can loop over generic iterables with `each [...iterable]`. +> Ekspresi (`cats`, dalam hal ini) bisa berbentuk sebuah *array* atau *array-like object* (i.e. memiliki properti `length`). Kamu bisa mengulang *generic iterable* dengan `each [...iterable]`. You can get the current *index* as a second argument, like so: +Kamu bisa mendapatkan *index* saat ini sebagai argumen, seperti: ```html {#each cats as cat, i} @@ -26,4 +27,4 @@ You can get the current *index* as a second argument, like so: {/each} ``` -If you prefer, you can use destructuring — `each cats as { id, name }` — and replace `cat.id` and `cat.name` with `id` and `name`. \ No newline at end of file +Jika kamu lebih suka, kamu bisa menggunakan *destructuring* - `each cats as { id, name }` - dan mengganti `cat.id` dan `cat.name` dengan `id` dan `name` saja. diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md index 4affb89..5e3bab5 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/05-keyed-each-blocks/text.md @@ -1,12 +1,12 @@ --- -title: Keyed each blocks +title: Mengunci blok each --- -By default, when you modify the value of an `each` block, it will add and remove items at the *end* of the block, and update any values that have changed. That might not be what you want. +Secara default, saat kamu mengubah value dari blok `each`, itu akan menambah dan menghapus item di *akhir* blok, dan memperbarui nilai apapun yg berubah. Itu mungkin bukan apa yang kamu inginkan. -It's easier to show why than to explain. Click the 'Remove first thing' button a few times, and notice that it's removing `` components from the end and updating the `color` for those that remain. Instead, we'd like to remove the first `` component and leave the rest unaffected. +Ini akan lebih mudah untuk ditunjukkan ketimbang dijelaskan. Klik tombol 'Remove first thing' beberapa kali, dan perhatikan itu menghapus komponen `` dari bawah dan memperbarui `warna` dari sisanya. Sedangkan, kita ingin menghapus komponen `` pertama dan membiarkan sisanya tidak terdampak. -To do that, we specify a unique identifier for the `each` block: +Untuk melakukan itu, kita spesifikasikan sebuah identitas unik untuk blok `each`: ```html {#each things as thing (thing.id)} @@ -14,6 +14,6 @@ To do that, we specify a unique identifier for the `each` block: {/each} ``` -The `(thing.id)` tells Svelte how to figure out what changed. +`(thing.id)` memberi tau Svelte bagaimana mencari apa yang berubah. -> You can use any object as the key, as Svelte uses a `Map` internally — in other words you could do `(thing)` instead of `(thing.id)`. Using a string or number is generally safer, however, since it means identity persists without referential equality, for example when updating with fresh data from an API server. +> Kamu bisa mengunakan objek sebagai sebuah kunci, karena Svelte menggunakan `Map` secara internal - dengan kata lain kamu bisa menggunakan `(thing)` dari pada `(thing.id)`. Mengunakan sebuah string atau angka lebih aman, namun, karena itu merupakan sebuah identitas yang bertahan tanpa persamaan referensial, misalnya saat kita memperbarui dengan data baru dari API *server*. diff --git a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/06-await-blocks/text.md b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/06-await-blocks/text.md index 0d47dcd..35142a3 100644 --- a/repositories/sveltejs/svelte/site/content/tutorial/04-logic/06-await-blocks/text.md +++ b/repositories/sveltejs/svelte/site/content/tutorial/04-logic/06-await-blocks/text.md @@ -1,8 +1,8 @@ --- -title: Await blocks +title: Blok await --- -Most web applications have to deal with asynchronous data at some point. Svelte makes it easy to *await* the value of [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) directly in your markup: +Kebanyakan aplikasi web harus berurusan dengan `asynchronous` data secara bersamaan. Svelte mempermudah untuk melakukan *await* nilai dari sebuah [*promise*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) secara langsung di markupmu: ```html {#await promise} @@ -14,12 +14,12 @@ Most web applications have to deal with asynchronous data at some point. Svelte {/await} ``` -> Only the most recent `promise` is considered, meaning you don't need to worry about race conditions. +> Hanya `promise` terbaru yang dipertimbangkan, artinya kamu tidak perlu khawatir dengan *race conditions*. -If you know that your promise can't reject, you can omit the `catch` block. You can also omit the first block if you don't want to show anything until the promise resolves: +Jika kamu tau *promise* mu tidak bisa di *reject*, kamu bisa menghilangan blok `catch`. Kamu juga bisa menghilangan blok pertama jika kamu tidak ingin menampilkan apapun sampai *promise* nya terselesaikan: ```html {#await promise then value}

the value is {value}

{/await} -``` \ No newline at end of file +```