Skip to content

Commit

Permalink
Translated Block Supports. Fixed minor typos
Browse files Browse the repository at this point in the history
  • Loading branch information
atachibana committed Nov 22, 2023
1 parent 1882173 commit bd8a5f5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ Everything you need to know to [start contributing to the block editor](/docs/co

2023/11/21
- [削除ボタンの追加](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/data-basics/5-adding-a-delete-button/) - 翻訳
- [ブロックサポート](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/block-tutorial/block-supports-in-static-blocks/) - 翻訳

2023/11/11
- 多数 - JSXを使用しないサンプルの削除
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<!--
# Block Supports
-->
# ブロックサポート

<!--
A lot of blocks, including core blocks, offer similar customization options. Whether that is to change the background color, text color, or to add padding, margin customization options...
-->
コアブロックを含む多くのブロックには、同じようなカスタマイズオプションがあります。たとえば背景色の変更、文字色の変更、パディングの追加、マージンのカスタマイズオプション等々。

<!--
To avoid duplicating the same logic over and over in your blocks and to align the behavior of your block with core blocks, you can make use of the different `supports` properties.
-->
ブロックの中で同じロジックを何度も何度も繰り返すのを避け、ブロックの動作をコアブロックに合わせるには、さまざまな `supports` プロパティを利用できます。

<!--
Let's take the block we wrote in the previous chapter (example 3) and with just a single line of code, add support for text, link and background color customizations.
-->
[前の章](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/) (例3) で作成したブロックを、たった1行のコードで、テキスト、リンク、背景色のカスタマイズに対応します。

<!--
Here's the exact same code we used to register the block previously.

-->
以下は、前の章でブロックを登録するのに使用したコードとまったく同じものです。

```jsx
import { registerBlockType } from '@wordpress/blocks';
Expand Down Expand Up @@ -62,7 +76,10 @@ registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
} );
```

<!--
Now, let's alter the block.json file for that block, and add the supports key. (If you're not using a block.json file, you can also add the key to the `registerBlockType` function call)
-->
では、ブロックの block.json ファイルを変更し、サポートキーを追加します。(block.json ファイルを使用していない場合は、`registerBlockType` 関数呼び出しにキーを追加できます)

```json
{
Expand All @@ -82,11 +99,25 @@ Now, let's alter the block.json file for that block, and add the supports key. (
}
```

<!--
And that's it, the addition of the "supports" key above, will automatically make the following changes to the block:
-->
以上です。上の「supports」キーの追加により、自動的にブロックに以下の変更が加えられます。

<!--
- Add a `style` attribute to the block to store the link, text and background colors.
- Add a "Colors" panel to the sidebar of the block editor to allow users to tweak the text, link and background colors.
- Automatically use the `theme.json` config: allow disabling colors, inherit palettes...
- Automatically inject the right styles and apply them to the block wrapper when the user make changes to the colors.
-->
- ブロックに `style` 属性を追加し、リンク、テキスト、背景の色を保存する。
- ブロックエディターのサイドバーに「色」パネルを追加し、ユーザーがテキスト、リンク、背景の色を調整できるようにする。
- 自動的に `theme.json` の構成を使用する。色を無効にしたり、パレットを継承したり...
- ユーザーが色を変更したときに、自動的に適切なスタイルを注入し、それらをブロックラッパーに適用する。

<!--
To learn more about the block supports and see all the available properties that you can enable for your own blocks, please refer to [the supports documentation](/docs/reference-guides/block-api/block-supports.md).
-->
ブロックサポートについての詳細と、自身のブロックで有効にできるすべての利用可能なプロパティを見るには、[supports documentation](/docs/reference-guides/block-api/block-supports.md) を参照してください。

[原文](https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/block-tutorial/block-supports-in-static-blocks.md)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This guide takes you through creating a basic block to display a message in a po
<!--
There are two main types of blocks: static and dynamic, this guide focuses on static blocks. A static block is used to insert HTML content into the post and save it with the post. A dynamic block builds the content on the fly when rendered on the front end, see the [dynamic blocks guide](/docs/how-to-guides/block-tutorial/creating-dynamic-blocks.md).
-->
ブロックには大きく分けて静的ブロックとダイナミックブロックがありますが、このガイドでは静的ブロックに焦点を当てます。静的ブロックは、HTML コンテンツを投稿に挿入し、投稿と一緒に保存するために使用されます。ダイナミックブロックは、フロントエンドでレンダーれる際に、その場でコンテンツを構築します。[ダイナミックブロックガイド](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/block-tutorial/creating-dynamic-blocks/)を参照してください。
ブロックには大きく分けて静的ブロックとダイナミックブロックがありますが、このガイドでは静的ブロックに焦点を当てます。静的ブロックは、HTML コンテンツを投稿に挿入し、投稿と一緒に保存するために使用されます。ダイナミックブロックは、フロントエンドでレンダーされる際に、その場でコンテンツを構築します。[ダイナミックブロックガイド](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/block-tutorial/creating-dynamic-blocks/)を参照してください。

<!--
<div class="callout callout-alert">
Expand Down
1 change: 1 addition & 0 deletions docs/japanese-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

2023/11/21
- [削除ボタンの追加](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/data-basics/5-adding-a-delete-button/) - 翻訳
- [ブロックサポート](https://ja.wordpress.org/team/handbook/block-editor/how-to-guides/block-tutorial/block-supports-in-static-blocks/) - 翻訳

2023/11/11
- 多数 - JSXを使用しないサンプルの削除
Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/block-api/block-variations.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ If another variation for the same block uses `isDefault`, your variation will no
<!--
The solution is to unregister the other variation before registering your variation with `isDefault`. This caveat reinforces the recommendation always to provide variations with a unique `name`. Otherwise, the variation cannot be unregistered.
-->
これを解決するには `isDefault` でバリエーションを登録する前に、他のバリエーションの登録を解除します。この解決策、前述した、バリエーションには常に一意の `name` をつける推奨を裏付けるものです。一意の名前でなければ、バリエーションを登録解除できません。
これを解決するには `isDefault` でバリエーションを登録する前に、他のバリエーションの登録を解除します。この解決策は前述した推奨「バリエーションには常に一意の `name` をつける」を裏付けるものです。一意の名前でなければ、バリエーションを登録解除できません。

<!--
## Using `isActive`
Expand Down Expand Up @@ -313,7 +313,7 @@ wp.blocks.registerBlockVariation(
<!--
The `isActive` check on both variations tests the `textColor`, but each variations uses `vivid-red`. Since the `paragraph-red` variation is registered first, once the `paragraph-red-grey` variation is inserted into the Editor, it will have the title `Red Paragraph` instead of `Red/Grey Paragraph`. As soon as the Editor finds a match, it stops checking.
-->
両方のバリエーションの `isActive` チェックでは `textColor` がテストされますが、それぞれのバリエーションでは `vivid-red` が使用されます。`paragraph-red` バリエーションが最初に登録されるため、`paragraph-red-grey` バリエーションがエディタに挿入されると、タイトルは `Red/Grey Paragraph` ではなく、`Red Paragraph` になります。エディターは一致するものを見つけるとすぐにチェックをやめます。
両方のバリエーションの `isActive` チェックでは `textColor` がテストされますが、それぞれのバリエーションでは `vivid-red` が使用されます。`paragraph-red` バリエーションが最初に登録されるため、`paragraph-red-grey` バリエーションがエディターに挿入されると、タイトルは `Red/Grey Paragraph` ではなく、`Red Paragraph` になります。エディターは一致するものを見つけるとすぐにチェックをやめます。

<!--
There have been [discussions](https://github.com/WordPress/gutenberg/issues/41303#issuecomment-1526193087) around how the API can be improved, but as of WordPress 6.3, this remains an issue to watch out for.
Expand Down

0 comments on commit bd8a5f5

Please sign in to comment.