Skip to content

#14 Components In-Depth > Non-Prop Attributes の翻訳 #74

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 8 commits into from
Sep 24, 2020

Conversation

mikakane
Copy link
Contributor

@mikakane mikakane commented Sep 21, 2020

fix #14

現行のドキュメント翻訳状況に沿って
Non-Prop Attributes  は 「プロパティでない属性」としています。

https://jp.vuejs.org/v2/guide/components-props.html#%E3%83%97%E3%83%AD%E3%83%91%E3%83%86%E3%82%A3%E3%81%A7%E3%81%AA%E3%81%84%E5%B1%9E%E6%80%A7

@mikakane mikakane changed the title WIP FIX #14 Components In-Depth > Non-Prop Attributes の翻訳 WIP #14 Components In-Depth > Non-Prop Attributes の翻訳 Sep 21, 2020
@netlify
Copy link

netlify bot commented Sep 21, 2020

Deploy preview for vuejs-v3-ja-doc-preview ready!

Built with commit ff7f7b7

https://deploy-preview-74--vuejs-v3-ja-doc-preview.netlify.app

@mikakane mikakane changed the title WIP #14 Components In-Depth > Non-Prop Attributes の翻訳 #14 Components In-Depth > Non-Prop Attributes の翻訳 Sep 21, 2020
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.

レビュー 👀 しました。
指摘コメント 💬 の対応お願いします。


Using our date-picker component example from the [previous section]('#attribute-inheritance), in the event we need to apply all non-prop attributes to the `input` element rather than the root `div` element, this can be accomplished by using the `v-bind` shortcut.
[previous section]('#属性の継承) で利用した date-picker のコンポーネント例を用いて、プロパティでない属性の全てを ルートの `div` 要素ではなく `input` 要素に適用する場合、`v-bind` を用いて簡略的に記述することも可能です。
Copy link
Member

Choose a reason for hiding this comment

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

previous section も訳せるので、以下のようにお願いします。

Suggested change
[previous section]('#属性の継承) で利用した date-picker のコンポーネント例を用いて、プロパティでない属性の全てを ルートの `div` 要素ではなく `input` 要素に適用する場合、`v-bind` を用いて簡略的に記述することも可能です。
[前節]('#属性の継承) で利用した date-picker のコンポーネント例を用いて、プロパティでない属性の全てを ルートの `div` 要素ではなく `input` 要素に適用する場合、`v-bind` を用いて簡略的に記述することも可能です。

@mikakane
Copy link
Contributor Author

上記の修正と合わせて class / id / style に関する認識違いがあったので修正しました。
4d4d1d4

@mikakane
Copy link
Contributor Author

$attr で class / id / style にアクセスできるようになったんですが、「Non props Attribute 」にはこのclass / id / style を含むんでしょうか?

冒頭の、

A component non-prop attribute is an attribute or event listener that is passed to a component, but does not have a corresponding property defined in props or emits. Common examples of this include class, style, and id attributes.

で、this include が全文主節にかかるのか but 節にかかるのかちょっと不明で判断しきれなかったです。

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.

こちらについて回答する形で、再度レビューしました。確認お願いします。


A component non-prop attribute is an attribute or event listener that is passed to a component, but does not have a corresponding property defined in [props](component-props) or [emits](component-custom-events.html#defining-custom-events). Common examples of this include `class`, `style`, and `id` attributes.
プロパティでない属性とは、コンポーネントに渡される属性やイベントリスナのうち、[props](component-props) [emits](component-custom-events.html#defining-custom-events) で定義されたものを除いたものをいいます。なお、共通の認識として `class``style`, `id` 属性はここに含まれません。
Copy link
Member

Choose a reason for hiding this comment

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

こちらのURLの件、ここで回答しますね。

$attr で class / id / style にアクセスできるようになったんですが、「Non props Attribute 」にはこのclass / id / style を含むんでしょうか?

恐らく $attr$attrs の typo だと思いますが、 $attrs と想定して回答すると、
この 「Non-Prop Attributes」 においては含まれますね。

DOM の id / class / style といった 属性、 click 、mousemove といったイベントは、コンポーネントの propsemits で定義しなければ、 $attrs でアクセス可能になります。
これら DOM の属性、イベントをコンポーネントのpropsemitsで定義した場合は、コンポーネント側で使用するため、$attrs でアクセスできなくなります。

「Non-Prop Attributes」では、用は $attrs について解説しています。

なので、

A component non-prop attribute is an attribute or event listener that is passed to a component, but does not have a corresponding property defined in props or emits. Common examples of this include class, style, and id attributes.

の訳は、わかりやすくするために、意訳も入れて以下にするといいかと思います。

Suggested change
プロパティでない属性とは、コンポーネントに渡される属性やイベントリスナのうち、[props](component-props)[emits](component-custom-events.html#defining-custom-events) で定義されたものを除いたものをいいます。なお、共通の認識として `class` `style`, `id` 属性はここに含まれません
プロパティでない属性とは、コンポーネントに渡される属性やイベントリスナのうち、[props](component-props)[emits](component-custom-events.html#defining-custom-events) で定義されたものを除いたものをいいます。一般の例としてはコンポーネント内の要素に渡す DOM の `class` `style``id` 属性があります

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ありがとうございます。

次のセクションで data-status 属性の例示をしていることから考えても、
ここでの classstyleid は 典型例ではなく、特記(v3での変更点)のような性質に近いものだと思っているんですが、 一般の例としては という形の表現で問題ないですか?

Copy link
Member

@kazupon kazupon Sep 23, 2020

Choose a reason for hiding this comment

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

commonscommon の訳は、「共通」とか以外に、「ありふれた」「よくある」などの意味があります。
DOM の属性は、front-end において、class / style / id はよく使うものなので、commons examples を「一般の例としては」のように訳しても問題ない思います。


By setting the `inheritAttrs` option to `false`, this gives you access to the component's `$attrs` property, which includes all attributes not included to component `props` and `emits` properties (e.g., `class`, `style`, `v-on` listeners, etc.).
`inheritAttrs` `false` にセットした場合、コンポーネントの `$attrs` プロパティを通じて、`props` `emits`といったコンポーネントのプロパティを除く全ての属性(例えば`class``style``v-on` といったものも)にアクセスできるようになります。
Copy link
Member

Choose a reason for hiding this comment

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

これ、原文がちょっと書き方よくない気がする...
inheritAttrs の値 true/false どちらでも、propsemits に定義されていない属性やイベントハンドラにアクセスできるのが今の仕様。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ですよね、そこの値で $attrs の有無がスイッチスルことはないと思うんですが。原文と挙動どっちに準拠するほうがよいです?

Copy link
Member

Choose a reason for hiding this comment

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

これ、原文直した方がいいですね。これ、自分 PR 送ってなおしておきます。
なので、inheritAttrs の boolean 値でトグルに関わらず、$attrs にアクセスできる、という内容を想定した訳にしていただきたいです。

@kazupon
Copy link
Member

kazupon commented Sep 24, 2020

本家ドキュメントにPR送って反映させました。

vuejs/docs#541

多分、これで違和感なくなると思います

@mikakane
Copy link
Contributor Author

@kazupon 上記修正してみました!

@kazupon
Copy link
Member

kazupon commented Sep 24, 2020

対応ありがとうございます。
確認しました!
LGTMです。

CIでエラーが起きていますが、翻訳作業に支障がない(このPRとは別事象)ので、マージします。

@kazupon kazupon merged commit aa0ffff into vuejs-jp:lang-ja Sep 24, 2020
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.

Components In-Depth > Non-Prop Attributes の翻訳
2 participants