Skip to content

docs(i18n-id): Provide Indonesian translation for array-refs, async-components, and attribute coercion #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions src/guide/migration/array-refs.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
---
title: v-for Array Refs
title: v-for Pada Array Refs
badges:
- breaking
---

# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />

In Vue 2, using the `ref` attribute inside `v-for` will populate the corresponding `$refs` property with an array of refs. This behavior becomes ambiguous and inefficient when there are nested `v-for`s present.
Pada Vue versi 2, penggunaan atribut `ref` di dalam `v-for` akan mengisi properti `$refs` dengan sebuah `ref` _array_. Perilaku tersebut menjadi ambigu dan tidak efisien ketika dilakukan pada `v-for` bersarang.

In Vue 3, such usage will no longer automatically create an array in `$refs`. To retrieve multiple refs from a single binding, bind `ref` to a function which provides more flexibility (this is a new feature):
Pada Vue versi 3, penggunaan tersebut tidak akan secara otomatis membuat sebuah _array_ pada `$refs`. Untuk mendapatkan banyak `ref` sekaligus dalam satu _binding_, _bind_ `ref` pada sebuah fungsi dimana hal tersebut memberikan lebih banyak fleskibilitas (hal ini merupakan sebuah fitur baru):

```html
<div v-for="item in list" :ref="setItemRef"></div>
<div v-for="barang in daftar" :ref="tetapkanRefBarang"></div>
```

With Options API:
Penggunaan dengan Options API:

```js
export default {
data() {
return {
itemRefs: []
refBarang: []
}
},
methods: {
setItemRef(el) {
this.itemRefs.push(el)
tetapkanRefBarang(el) {
this.refBarang.push(el)
}
},
beforeUpdate() {
this.itemRefs = []
this.refBarang = []
},
updated() {
console.log(this.itemRefs)
console.log(this.refBarang)
}
}
```

With Composition API:
Penggunaan dengan Composition API:

```js
import { ref, onBeforeUpdate, onUpdated } from 'vue'

export default {
setup() {
let itemRefs = []
const setItemRef = el => {
itemRefs.push(el)
let refBarang = []
const tetapkanRefBarang = el => {
refBarang.push(el)
}
onBeforeUpdate(() => {
itemRefs = []
refBarang = []
})
onUpdated(() => {
console.log(itemRefs)
console.log(refBarang)
})
return {
itemRefs,
setItemRef
refBarang,
tetapkanRefBarang
}
}
}
```

Note that:
Ingat bahwa:

- `itemRefs` doesn't have to be an array: it can also be an object where the refs are set by their iteration keys.
- `refBarang` tidak harus merupakan sebuah _array_: boleh berupa sebuah objek dimana `ref` ditetapkan menggunakan kunci iterasi masing-masing.

- This also allows `itemRefs` to be made reactive and watched, if needed.
- Cara ini juga memungkinkan `refBarang` untuk dijadikan reaktif dan dapat diawasi, jika dibutuhkan.
60 changes: 30 additions & 30 deletions src/guide/migration/async-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,91 +3,91 @@ badges:
- new
---

# Async Components <MigrationBadges :badges="$frontmatter.badges" />
# Komponen Asinkron <MigrationBadges :badges="$frontmatter.badges" />

## Overview
## Gambaran Umum

Here is a high level overview of what has changed:
Berikut merupakan gambaran umum tentang perubahan yang terjadi:

- New `defineAsyncComponent` helper method that explicitly defines async components
- `component` option renamed to `loader`
- Loader function does not inherently receive `resolve` and `reject` arguments and must return a Promise
- Fungsi bantuan baru bernama `defineAsyncComponent` yang secara eksplisit menyatakan komponen asinkron
- Opsi `component` diubah menjadi `loader`
- Fungsi pemuat tidak lagi memiliki argumen `resolve` dan `reject` dan harus mengembalikan sebuah `Promise`

For a more in-depth explanation, read on!
Silahkan membaca untuk penjelasan lebih lanjut

## Introduction
## Perkenalan

Previously, async components were created by simply defining a component as a function that returned a promise, such as:
Sebelumnya, komponen asinkron dibuat dengan menyatakan sebuah komponen sebagai sebuah fungsi yang mengembalikan sebuah `Promise`, seperti:

```js
const asyncPage = () => import('./NextPage.vue')
const halamanAsinkron = () => import('./HalamanSelanjutnya.vue')
```

Or, for the more advanced component syntax with options:
Atau, dengan sintaks komponen yang lebih rumit yang memiliki opsi:

```js
const asyncPage = {
component: () => import('./NextPage.vue'),
const halamanAsinkron = {
component: () => import('./HalamanSelanjutnya.vue'),
delay: 200,
timeout: 3000,
error: ErrorComponent,
loading: LoadingComponent
}
```

## 3.x Syntax
## Sintaks Pada Versi 3.x

Now, in Vue 3, since functional components are defined as pure functions, async components definitions need to be explicitly defined by wrapping it in a new `defineAsyncComponent` helper:
Sekarang di Vue versi 3 karena komponen fungsional dinyatakan sebagai fungsi murni, pernyataan komponen asinkron harus dinyatakan secara eksplisit dengan membungkus komponen dengan sebuah fungsi bantuan bernama `defineAsyncComponent`:

```js
import { defineAsyncComponent } from 'vue'
import ErrorComponent from './components/ErrorComponent.vue'
import LoadingComponent from './components/LoadingComponent.vue'

// Async component without options
const asyncPage = defineAsyncComponent(() => import('./NextPage.vue'))
// Komponen asinkron tanpa opsi
const halamanAsinkron = defineAsyncComponent(() => import('./HalamanSelanjutnya.vue'))

// Async component with options
const asyncPageWithOptions = defineAsyncComponent({
loader: () => import('./NextPage.vue'),
// Komponen asinkron yang memiliki opsi
const halamanAsinkronDenganOpsi = defineAsyncComponent({
loader: () => import('./HalamanSelanjutnya.vue'),
delay: 200,
timeout: 3000,
errorComponent: ErrorComponent,
loadingComponent: LoadingComponent
})
```

Another change that has been made from 2.x is that the `component` option is now renamed to `loader` in order to accurately communicate that a component definition cannot be provided directly.
Perubahan lain yang terjadi dari Vue versi 2 adalah opsi `component` yang diubah menjadi `loader` yang bertujuan untuk menyampaikan bahwa pernyataan komponen tidak dapat disediakan secara langsung.

```js{4}
import { defineAsyncComponent } from 'vue'

const asyncPageWithOptions = defineAsyncComponent({
loader: () => import('./NextPage.vue'),
const halamanAsinkronDenganOpsi = defineAsyncComponent({
loader: () => import('./HalamanSelanjutnya.vue'),
delay: 200,
timeout: 3000,
error: ErrorComponent,
loading: LoadingComponent
})
```

In addition, unlike 2.x, the loader function no longer receives the `resolve` and `reject` arguments and must always return a Promise.
Selain itu, tidak sepert pada Vue versi 2, fungsi pemuat tidak lagi memiliki argumen `resolve` dan `reject` dan harus selalu mengembalikan sebuah `Promise`

```js
// 2.x version
const oldAsyncComponent = (resolve, reject) => {
// Pada Vue versi 2.0
const komponenAsinkronLama = (resolve, reject) => {
/* ... */
}

// 3.x version
const asyncComponent = defineAsyncComponent(
// Pada Vue versi 3.0
const komponenAsinkron = defineAsyncComponent(
() =>
new Promise((resolve, reject) => {
/* ... */
})
)
```

For more information on the usage of async components, see:
Anda dapat mempelajari lebih lanjut tentang penggunaan komponen asinknron pada:

- [Guide: Dynamic & Async Components](/guide/component-dynamic-async.html#dynamic-components-with-keep-alive)
- [Panduan: Komponen Dinamis dan Asinkron](/guide/component-dynamic-async.html#dynamic-components-with-keep-alive)
Loading