Skip to content

API Reference > Refs の翻訳 #545

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 3 commits into from
Oct 29, 2021
Merged

API Reference > Refs の翻訳 #545

merged 3 commits into from
Oct 29, 2021

Conversation

jay-es
Copy link
Member

@jay-es jay-es commented Oct 22, 2021

Description of Problem

API Reference > Refs を翻訳しました
原文ページ:
https://v3.vuejs.org/api/refs-api.html

Proposed Solution

Additional Information

@netlify
Copy link

netlify bot commented Oct 22, 2021

✔️ Deploy Preview for vuejs-v3-ja-doc-preview ready!

🔨 Explore the source changes: a24df84

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-v3-ja-doc-preview/deploys/617bf1f4ad4edc00088c9923

😎 Browse the preview: https://deploy-preview-545--vuejs-v3-ja-doc-preview.netlify.app

@@ -28,15 +28,15 @@ interface Ref<T> {
function ref<T>(value: T): Ref<T>
```

Sometimes we may need to specify complex types for a ref's inner value. We can do that succinctly by passing a generics argument when calling `ref` to override the default inference:
場合によっては、ref の内部値に複合の型を指定する必要があります。そのような場合には、`ref` を呼び出す際にジェネリクス引数を渡して、デフォルトの推論をオーバーライドすることで、簡潔に指定できます。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下は、読んでいて原文への違和感。(独り言

Generics っていうキーワードが出てきているけど、TypeScript 知っていることを前提にかかれているのかな。 🤔

@@ -47,17 +47,17 @@ function useState<State extends string>(initial: State) {

## `unref`

Returns the inner value if the argument is a [`ref`](#ref), otherwise return the argument itself. This is a sugar function for `val = isRef(val) ? val.value : val`.
引数が [`ref`](#ref) の場合はその内部の値を、そうでない場合は引数そのものを返します。これは、`val = isRef(val) ? val.value : val` のシュガー関数です。
Copy link
Member

@kazupon kazupon Oct 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sugar ですが、プログラミングの文脈ではよく使う言葉なので�その辺に精通している人は、シュガーという訳だけで分かるかと思います。ただ、front-end の領域は、それほとプログラミングに精通しているいない人が使うことがあるので、ここで注釈も加えて訳にしておいた方がいいです。
sugar は文脈的に、簡略的なことを意味していると思うので、シュガー(簡易) とかどうでしょうか。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「syntax sugar」のシュガーと言われればピンときますが、単体で言われると補足必要ですね 🤔

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー 👀 コメント 💬 しました!
確認お願いします! 🙏

@@ -74,7 +74,7 @@ state.foo++
console.log(fooRef.value) // 3
```

`toRef` is useful when you want to pass the ref of a prop to a composition function:
`toRef` は、prop の ref をコンポジション関数に渡したいときに便利です:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

composition functioncomposition は日本語訳の方では、Composition API をそのままな形にしてきているので、一貫性を保ちたいです。(そもそも個人的には原文の方は、composable function にしたい 😅 )composition (構成:

state.foo++
console.log(stateAsRefs.foo.value) // 2

stateAsRefs.foo.value++
console.log(state.foo) // 3
```

`toRefs` is useful when returning a reactive object from a composition function so that the consuming component can destructure/spread the returned object without losing reactivity:
`toRefs` は、コンポジション関数からリアクティブなオブジェクトを返すときに便利で、利用する側のコンポーネントはリアクティビティを失うことなく、返されたオブジェクトを分割代入できます:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここの compostion function同じく

# Conflicts:
#	src/api/reactivity-api.md
@jay-es
Copy link
Member Author

jay-es commented Oct 29, 2021

修正しました。ご確認よろしくお願いします:pray:

@jay-es jay-es requested review from kazupon and naokie October 29, 2021 13:08
@kazupon kazupon merged commit ae02c09 into vuejs-jp:lang-ja Oct 29, 2021
@kazupon
Copy link
Member

kazupon commented Oct 29, 2021

@jay-es
翻訳、ありがとうございました!
マージしました!

@jay-es jay-es deleted the 02-refs branch October 29, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants