Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
該当箇所の訳出 #1371
該当箇所の訳出 #1371
Conversation
ひとまず誤検知について該当箇所を書きました! Suggestion も使ってあるので、適宜取り込んで修正お願いします |
提案ありがとうございます。そのまま採用させてください。 Co-Authored-By: superyusuke <nakanishiyusuke0000@gmail.com>
…nto practical-use-of-scoped-slots # Conflicts: # src/v2/cookbook/practical-use-of-scoped-slots.md
一旦申請しました〜 |
レビュー 後、いくつか 訳注あると確かに読み手の参考になっていいのですが、なるべく無い形にしたいので、文章に意訳的な形で盛り込む形式にしてもらえると助かります。 どうしても、訳注として残したい場合は、コメントください。 |
There are situations when you want the template inside the slot to be able to access data from the child component that is responsible for rendering the slot content. This is particularly useful when you need freedom in creating custom templates that use the child component's data properties. That is a typical use case for scoped slots. | ||
> Base Example | ||
slot 内の template が、slot の content をレンダリングをする役割を持った子コンポーネントの側の「データ」へ、アクセスできたらいいのに、と思うことはないでしょうか。 |
kazupon
Jan 1, 2019
Member
slot、template、そして content をそのまま英語のままにしていますが、ここの文章の文脈では、特にそのまま訳しても文章として問題ないので、訳すようお願いします。
ref: 日本語公式ドキュメント
https://jp.vuejs.org/v2/guide/components-slots.html
|
||
> There are situations when you want the template inside the slot to be able to access data from the child component that is responsible for rendering the slot content. | ||
とくにそれが有効なのは、子コンポーネントの data プロパティを使用するカスタム template を作成する必要がある場合です。まさに `scoped slots` を使用するのに最適な場面です。 |
kazupon
Jan 1, 2019
Member
scoped slots
ですが、なるべく日本語公式ドキュメントを一貫性保ちたいので、こちらも スコープ付きスロット
で訳お願いします。
スコープ付きスロット (scoped slots)
でも可です。
|
||
> This is particularly useful when you need freedom in creating custom templates that use the child component's data properties. That is a typical use case for scoped slots. | ||
外部 API の設定と使用準備をするコンポーネントを実装する場合を想定してみましょう。そのコンポーネントは、他のコンポーネントから使用されるわけですが、具体的な template と密接には結びついません。そのためレンダリングする template が異なる様々な場所で使いまわすことができ、それでいて特定の API を持つ同じベースオブジェクトを使用します。 |
1. [Google Maps API](https://developers.google.com/maps/documentation/javascript/reference/) を初期化する。 | ||
2. `google` と `map` の2つの object を作成する。 | ||
3. これら2つの object を `GoogleMapLoader` を使用する親コンポーネントに対して露出させている。 |
`GoogleMapLoader.vue` | ||
|
||
In the template, we create a container for the map which will be used to mount the [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map) object extracted from the Google Maps API. | ||
template の中にマップのためのコンテナを作成しましょう。このコンテナへ Google Maps API から抽出した [Map](https://developers.google.com/maps/documentation/javascript/reference/map#Map) がマウントされます。 |
kazupon
Jan 1, 2019
Member
ここの template
は、 SFC の template ブロックのことなので、この文章ではこのままででいいですが、注釈しておくと分かりやすいですね。
(そもそも、原文もちょっと分かりづらいですね。。。せめて quote してあると分かりやすいですね。。。余力があれば、本家にPR送ってもいいかもしれません。)
@@ -337,7 +438,9 @@ Here we go, integrating the data points directly into the template: | |||
</GoogleMapLoader> | |||
``` | |||
|
|||
We need to import the required factory components in our script and set the data that will be passed to the markers and lines: | |||
それから script の中で、factory component を script の中でインポートし、marker と lines という名前でコンポーネントに値をセットします。 |
kazupon
Jan 1, 2019
Member
それから script の中で、factory component を script の中でインポートし、marker と lines という名前でコンポーネントに値をセットします。 | |
それから script の中で、ファクトリーコンポーネントを script の中でインポートし、marker と lines という名前でコンポーネントに値をセットします。 |
@@ -379,9 +482,18 @@ export default { | |||
``` | |||
|
|||
## When To Avoid This Pattern |
|
||
## Wrapping Up | ||
That's it. With all those bits and pieces created we can now re-use the `GoogleMapLoader` component as a base for all our maps by passing different templates to each one of them. Imagine that you need to create another map with different Markers or just Markers without Polylines. By using the above pattern it becomes very easy as we just need to pass different content to the `GoogleMapLoader` component. | ||
このような非常に複雑な解決法は魅力的に思われるかもしれませんが、ある一定のレベルまでその複雑さが進んでしまうと、その抽象性が、この機能を構成する他のコードの部分よりもかなり高くなってしまい、浮いた存在になってしまうでしょう。その段階にまできた場合には、add-on に抽出することを検討する段階でしょう。(訳注: add-on はおそらく、plugin や mixin などのことです) |
kazupon
Jan 1, 2019
Member
このような非常に複雑な解決法は魅力的に思われるかもしれませんが、ある一定のレベルまでその複雑さが進んでしまうと、その抽象性が、この機能を構成する他のコードの部分よりもかなり高くなってしまい、浮いた存在になってしまうでしょう。その段階にまできた場合には、add-on に抽出することを検討する段階でしょう。(訳注: add-on はおそらく、plugin や mixin などのことです) | |
このような非常に複雑な解決法は魅力的に思われるかもしれませんが、ある一定のレベルまでその複雑さが進んでしまうと、その抽象性が、この機能を構成する他のコードの部分よりもかなり高くなってしまい、浮いた存在になってしまうでしょう。その段階にまできた場合には、プラグインやミックスインのようなアドオンとして抽出することを検討する段階でしょう。 |
## まとめ | ||
> Wrapping Up | ||
さあ全てやりとげました。こまごまと作業をしてきた結果として `GoogleMapLoader` コンポーネントを、マップを使う際のベースとして使いまわすことができるようになりました。それぞれの用途に合わせた template を渡せばこのコンポーネントに渡せば、どんなものにでも対応できます。例えば今回のケースとは異なるマーカーや、ポリラインがない場合にも使えますね。今回紹介したパターンを使うことで `GoogleMapLoader` にケースによってことなる必要なコンテンツを渡すだけで、この目的を達成できます。 |
kazupon
Jan 1, 2019
Member
さあ全てやりとげました。こまごまと作業をしてきた結果として `GoogleMapLoader` コンポーネントを、マップを使う際のベースとして使いまわすことができるようになりました。それぞれの用途に合わせた template を渡せばこのコンポーネントに渡せば、どんなものにでも対応できます。例えば今回のケースとは異なるマーカーや、ポリラインがない場合にも使えますね。今回紹介したパターンを使うことで `GoogleMapLoader` にケースによってことなる必要なコンテンツを渡すだけで、この目的を達成できます。 | |
以上です。こまごまと作業をしてきた結果として `GoogleMapLoader` コンポーネントを、マップを使う際のベースとして使いまわすことができるようになりました。それぞれの用途に合わせたテンプレートをこのコンポーネントに渡せば、どんなものにでも対応できます。例えば今回のケースとは異なるマーカーや、ポリラインがない場合にも使えます。今回紹介したパターンを使うことで `GoogleMapLoader` にケースによってことなる必要なコンテンツを渡すだけで、この目的を達成できます。 |
|
||
> That's it. With all those bits and pieces created we can now re-use the `GoogleMapLoader` component as a base for all our maps by passing different templates to each one of them. Imagine that you need to create another map with different Markers or just Markers without Polylines. By using the above pattern it becomes very easy as we just need to pass different content to the `GoogleMapLoader` component. | ||
このパターンは Google Map の場合にしか使えないわけではありません。どんなライブラリの場合にも、ベースとなるコンポーネントをセットして、(ベースコンポーネントを呼び出したコンポーネントが実行する) API を露出させればいいのです。 |
kazupon
Jan 1, 2019
Member
このパターンは Google Map の場合にしか使えないわけではありません。どんなライブラリの場合にも、ベースとなるコンポーネントをセットして、(ベースコンポーネントを呼び出したコンポーネントが実行する) API を露出させればいいのです。 | |
このパターンは Google Map の場合にしか使えないわけではありません。どんなライブラリの場合にも、ベースとなるコンポーネントをセットして、(ベースコンポーネントを呼び出したコンポーネントが実行する) API を公開させればいいのです。 |
@superyusuke |
@potato4d |
@superyusuke |
この PR のまま引き継ぐのがちょっとコスト的に高いので別途 PR を出します |
* Create new page * Update * Improve intro * Update * Add Example * Include real world example and explanation about testing * Added "Why vue" en, cn srt files into assets folder (vuejs#1367) * added english srt file * added chinese srt file * typo * fix: Correct sidebar anchor targets (vuejs#1366) Change function execution order to correct sidebar anchor targets; more concise fix to vuejs/vuejs.org#1348. * Images not found. (vuejs#1365) Hi, The images link for `hn.png` and `hn-architecture.png` can be found on `../../images/`. * [Doc EN]: `event.md` add space to new part (vuejs#1363) * New in with + symbol Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com> * Review of 2.5.0 doc Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com> * Review Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com> * Fix syntax typo Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com> * Add space between new line of documentation Signed-off-by: MachinisteWeb <bruno.lesieur@gmail.com> * Add @posva review Signed-off-by: MachinisteWeb <bruno.lesieur@gmail.com> * Retrieve tweeningValue from onUpdate callback in documentation (vuejs#1350) The tweeningValue no longer seems to be available in the tween object itself. Instead, the tweeningValue is available in the tweened object that passed as a parameter to the onUpdate callback. * Add watch usages (vuejs#1356) * Add watch usages! Add `watch` usages! * Update index.md * tweaks to watch api examples * Avoid updating license every year (vuejs#1353) * Update spelling error and add some details about what we are testing * Update * typo for chinese subtitles of "why vue" video (vuejs#1371) * Adding Why Vue.js video to Introduction page (vuejs#1377) * Added video into guide introduction * Added modal styles to page, put video line on one file, and reset iframe margin * Fixed typo in Gulp example in deployment.md (vuejs#1376) * Update deployment.md with Grunt example (vuejs#1375) * Decoupled video player from Vimeo (vuejs#1374) * Update Installation guide to use https://caniuse.com (vuejs#1372) * [HOTFIX] initVideoModal error in common.js (vuejs#1378) * Showing all possible params of watch() (vuejs#1380) Surprised that the documentation didn't include the fact that the 2nd argument is the previous value. This can be really useful in some cases! * refactor & update sponsors display * include bronze data * fix link * fix link * add build script * update deploy docs * Small fixes (vuejs#1381) * fixed video modal bug in guide/index.md * removed unnecessary sponsors content which has been in theme layout now * fixed sponsors dropdown menu * fixed button style in team page * update Guillaume's core focus * Improve based on Sarah Drasner feedback and fix some grammar * Fixed TYPO Automatic Key Modifiers (vuejs#1388) * update community deployment instructions * Tweak wording of `.passive` modifier explanation * Add guide link in Vue.filter API (vuejs#1394) * Update filters, global filters needs to go before Vue instance creation (vuejs#1392) Global filters defined after creating the Vue instance throws `Failed to resolve filter`. Reference https://forum.vuejs.org/t/global-filters-failing-to-resolve-inside-single-file-components/21863/6 * update tree-view example to add v-for key * add details of object merging to mixins page * Revise beforeUpdate API entry, fixes vuejs/vue#7481 (vuejs#1395) * fix vue team distance sorting * Add explicit version to download links (vuejs#1398) * Add explicit version to download links * improve CDN section of installation page * demo from ’Object Change Detection‘ doesn't work (vuejs#1397) vm.$set(this.userProfile, 'age', 27) ==> vm.$set(vm.userProfile, 'age', 27); * Updated description of Weex (vuejs#1396) * updated description of Weex (close vuejs#1382) * Update comparison.md * Update "incubated to" -> "incubated by" * Update comparison.md * Update comparison.md * fix vue component require syntax for modern vue-loader * The Web Optimization Project has optimized your repository! (vuejs#1389) The Web Optimization Project optimized this repository. This commit contains the optimized files in this repository. * Fix wrapperfind(error) typo and add example to test for whitespace * Update * Use factory function to save redundant logic * Add factory function explanation and link to vue test utils guides. * Update using codebryo feedback * Change Github to GitHub (vuejs#1399) * Fixed js error when click the page (vuejs#1401) * Change cookbook entry number and reformat sentence * Change order * fix: typo in v-show description (vuejs#1408) * Create new page * Update * Improve intro * Update * Add Example * Include real world example and explanation about testing * Update spelling error and add some details about what we are testing * Update * Improve based on Sarah Drasner feedback and fix some grammar * Fix wrapperfind(error) typo and add example to test for whitespace * Update * Use factory function to save redundant logic * Add factory function explanation and link to vue test utils guides. * Update using codebryo feedback * Change cookbook entry number and reformat sentence * Change order * Rebase
概要
resolve #1297
リントの語調統一ルールにひっかかって、エラーが出た状態でプルリク出させていただきました。自分ではですますに統一したつもりです。申し訳ありません。
補足