-
Notifications
You must be signed in to change notification settings - Fork 87
#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
Conversation
Deploy preview for vuejs-v3-ja-doc-preview ready! Built with commit ff7f7b7 https://deploy-preview-74--vuejs-v3-ja-doc-preview.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビュー 👀 しました。
指摘コメント 💬 の対応お願いします。
src/guide/component-attrs.md
Outdated
|
||
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` を用いて簡略的に記述することも可能です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous section
も訳せるので、以下のようにお願いします。
[previous section]('#属性の継承) で利用した date-picker のコンポーネント例を用いて、プロパティでない属性の全てを ルートの `div` 要素ではなく `input` 要素に適用する場合、`v-bind` を用いて簡略的に記述することも可能です。 | |
[前節]('#属性の継承) で利用した date-picker のコンポーネント例を用いて、プロパティでない属性の全てを ルートの `div` 要素ではなく `input` 要素に適用する場合、`v-bind` を用いて簡略的に記述することも可能です。 |
上記の修正と合わせて class / id / style に関する認識違いがあったので修正しました。 |
$attr で class / id / style にアクセスできるようになったんですが、「Non props Attribute 」にはこのclass / id / style を含むんでしょうか? 冒頭の、
で、 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こちらについて回答する形で、再度レビューしました。確認お願いします。
src/guide/component-attrs.md
Outdated
|
||
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` 属性はここに含まれません。 |
There was a problem hiding this comment.
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 といったイベントは、コンポーネントの props
、emits
で定義しなければ、 $attrs
でアクセス可能になります。
これら DOM の属性、イベントをコンポーネントのprops
、emits
で定義した場合は、コンポーネント側で使用するため、$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
, andid
attributes.
の訳は、わかりやすくするために、意訳も入れて以下にするといいかと思います。
プロパティでない属性とは、コンポーネントに渡される属性やイベントリスナのうち、[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` 属性があります。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。
次のセクションで data-status
属性の例示をしていることから考えても、
ここでの class
、style
、id
は 典型例ではなく、特記(v3での変更点)のような性質に近いものだと思っているんですが、 一般の例としては
という形の表現で問題ないですか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commons
の common
の訳は、「共通」とか以外に、「ありふれた」「よくある」などの意味があります。
DOM の属性は、front-end において、class
/ style
/ id
はよく使うものなので、commons examples
を「一般の例としては」のように訳しても問題ない思います。
src/guide/component-attrs.md
Outdated
|
||
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` といったものも)にアクセスできるようになります。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ、原文がちょっと書き方よくない気がする...
inheritAttrs
の値 true/false
どちらでも、props
、emits
に定義されていない属性やイベントハンドラにアクセスできるのが今の仕様。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ですよね、そこの値で $attrs の有無がスイッチスルことはないと思うんですが。原文と挙動どっちに準拠するほうがよいです?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これ、原文直した方がいいですね。これ、自分 PR 送ってなおしておきます。
なので、inheritAttrs
の boolean 値でトグルに関わらず、$attrs にアクセスできる、という内容を想定した訳にしていただきたいです。
本家ドキュメントにPR送って反映させました。 多分、これで違和感なくなると思います |
@kazupon 上記修正してみました! |
対応ありがとうございます。 CIでエラーが起きていますが、翻訳作業に支障がない(このPRとは別事象)ので、マージします。 |
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