Skip to content

Commit ec073ba

Browse files
Naturalclarkoba04
authored andcommitted
Translate web-components.md (#102)
* docs:translate web-components.md * docs: fix minor details * doc: modify imperative wording * docs: apply text lint
1 parent c79fd60 commit ec073ba

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

content/docs/web-components.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ redirect_from:
66
- "docs/webcomponents.html"
77
---
88

9-
React and [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) are built to solve different problems. Web Components provide strong encapsulation for reusable components, while React provides a declarative library that keeps the DOM in sync with your data. The two goals are complementary. As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both.
9+
React [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) は異なる課題を解決する為に構築されました。Web Components はコンポーネントをパッケージ化して、高い再利用性を与えます。一方で React DOM とデータを同期させる為の宣言型のライブラリを提供しています。この 2 つの目標は互いを補完しあっています。あなたは開発者として、Web Components 内で React を使用することも、React 内で Web Components を使用することも、あるいはその両方を行うこともできます。
1010

11-
Most people who use React don't use Web Components, but you may want to, especially if you are using third-party UI components that are written using Web Components.
11+
React を使用するほとんどの人は Web Components を使用しませんが、Web Components を用いたサードパーティ製の UI コンポーネントを使用したい時などには活用できるかもしれません。
1212

13-
## Using Web Components in React {#using-web-components-in-react}
13+
## React で Web Components を使用する {#using-web-components-in-react}
1414

1515
```javascript
1616
class HelloMessage extends React.Component {
@@ -20,14 +20,14 @@ class HelloMessage extends React.Component {
2020
}
2121
```
2222

23-
> Note:
23+
> 補足:
2424
>
25-
> Web Components often expose an imperative API. For instance, a `video` Web Component might expose `play()` and `pause()` functions. To access the imperative APIs of a Web Component, you will need to use a ref to interact with the DOM node directly. If you are using third-party Web Components, the best solution is to write a React component that behaves as a wrapper for your Web Component.
25+
> Web Components はよく命令型の API を公開しています。例えば、`video` という Web Component `play()` `pause()` といった関数を公開しているかもしれません。Web Component が使う命令型の API にアクセスするには DOM ノードと直接やり取りするために ref を使う必要があります。サードパーティ製の Web Components を使用している場合は、Web Component のラッパとして機能する React のコンポーネントを作成するのがベストな選択でしょう。
2626
>
27-
> Events emitted by a Web Component may not properly propagate through a React render tree.
28-
> You will need to manually attach event handlers to handle these events within your React components.
27+
> Web Component から発された Event は React のレンダーツリーを正しく伝わってこない可能性があります。
28+
> React コンポーネント内でイベントに適切に対応するにはそのためのイベントハンドラを与える必要があります。
2929
30-
One common confusion is that Web Components use "class" instead of "className".
30+
よくある混乱のひとつとして、Web Components が "className" の代わりに "class" を使用しているケースがあります。
3131

3232
```javascript
3333
function BrickFlipbox() {
@@ -40,7 +40,7 @@ function BrickFlipbox() {
4040
}
4141
```
4242

43-
## Using React in your Web Components {#using-react-in-your-web-components}
43+
## Web Components で React を使用する {#using-react-in-your-web-components}
4444

4545
```javascript
4646
class XSearch extends HTMLElement {
@@ -56,7 +56,7 @@ class XSearch extends HTMLElement {
5656
customElements.define('x-search', XSearch);
5757
```
5858

59-
>Note:
59+
>補足:
6060
>
61-
>This code **will not** work if you transform classes with Babel. See [this issue](https://github.com/w3c/webcomponents/issues/587) for the discussion.
62-
>Include the [custom-elements-es5-adapter](https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs) before you load your web components to fix this issue.
61+
>Babel を使ってクラス変換を行うと上記のコードは**機能しません**。詳細や議論は[この issue](https://github.com/w3c/webcomponents/issues/587) を参照してください。
62+
>この問題を解決するには [custom-elements-es5-adapter](https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs) をあなたの web component の前に読み込む必要があります。

0 commit comments

Comments
 (0)