Skip to content

Commit d852aa2

Browse files
committed
docs: translate cookbook > editable svg icon systems
1 parent e5a3a19 commit d852aa2

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/cookbook/editable-svg-icons.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# Editable SVG Icon Systems
1+
# 編集可能な SVG アイコンシステム
22

3-
## Base Example
3+
## 基本的な例
44

5-
There are many ways to create an SVG Icon System, but one method that takes advantage of Vue's capabilities is to create editable inline icons as components. Some of the advantages of this way of working is:
5+
SVG アイコンシステムを作成する方法はいろいろありますが、 Vue の機能を生かした方法として、編集可能なインラインのアイコンをコンポーネントとして作成する方法があります。この方法のいくつかの利点としては:
66

7-
- They are easy to edit on the fly
8-
- They are animatable
9-
- You can use standard props and defaults to keep them to a typical size or alter them if you need to
10-
- They are inline, so no HTTP requests are necessary
11-
- They can be made accessible dynamically
7+
- 即座に編集することが簡単です
8+
- アニメーションが可能です
9+
- 標準的なプロパティとデフォルトを利用して標準サイズを保つことができ、必要に応じて変更することもできます
10+
- インラインなので HTTP リクエストが不要です
11+
- 動的にアクセスすることが可能です
1212

13-
First, we'll create a folder for all of the icons, and name them in a standardized fashion for easy retrieval:
13+
まず、すべてのアイコンを入れるフォルダを作り、検索しやすいように一定のルールで命名します:
1414

1515
- `components/icons/IconBox.vue`
1616
- `components/icons/IconCalendar.vue`
1717
- `components/icons/IconEnvelope.vue`
1818

19-
Here's an example repo to get you going, where you can see the entire setup: [https://github.com/sdras/vue-sample-svg-icons/](https://github.com/sdras/vue-sample-svg-icons/)
19+
ここにセットアップの全体像を見られるサンプルのリポジトリがあります: [https://github.com/sdras/vue-sample-svg-icons/](https://github.com/sdras/vue-sample-svg-icons/)
2020

2121
![Documentation site](/images/editable-svg-icons.jpg 'Docs demo')
2222

23-
We'll create a base icon (`IconBase.vue`) component that uses a slot.
23+
スロットを利用した基本となるアイコン(`IconBase.vue`)コンポーネントを作成します。
2424

2525
```html
2626
<template>
@@ -40,9 +40,9 @@ We'll create a base icon (`IconBase.vue`) component that uses a slot.
4040
</template>
4141
```
4242

43-
You can use this base icon as is- the only thing you might need to update is the `viewBox` depending on the `viewBox` of your icons. In the base, we're making the `width`, `height`, `iconColor`, and name of the icon props so that it can be dynamically updated with props. The name will be used for both the `<title>` content and its `id` for accessibility.
43+
アイコンの `viewBox` に応じて `viewBox` を更新する必要があるだけで、この基本となるアイコンをそのまま使うことができます。この基本では、 `width``height``iconColor` とアイコン名をプロパティにして、プロパティから動的に更新できるようにしています。名前は `<title>` のコンテンツと、アクセシビリティのための `id` の両方に使われます。
4444

45-
Our script will look like this, we'll have some defaults so that our icon will be rendered consistently unless we state otherwise:
45+
スクリプト部分はこのようになります。いくつかのデフォルトがあり、特に指定しない限り、アイコンが一貫してレンダリングされるようにします:
4646

4747
```js
4848
export default {
@@ -67,32 +67,32 @@ export default {
6767
}
6868
```
6969

70-
The `currentColor` property that's the default on the fill will make the icon inherit the color of whatever text surrounds it. We could also pass in a different color as a prop if we wish.
70+
塗りつぶし色のデフォルト `currentColor` プロパティは、アイコンの周囲のテキスト色を継承します。必要なら、別の色をプロパティとして渡すこともできます。
7171

72-
We can use it like so, with the only contents of `IconWrite.vue` containing the paths inside the icon:
72+
アイコンのパスを内包する `IconWrite.vue` だけを内容にすると、このように使えます:
7373

7474
```html
7575
<icon-base icon-name="write"><icon-write /></icon-base>
7676
```
7777

78-
Now, if we'd like to make many sizes for the icon, we can do so very easily:
78+
さまざまなサイズのアイコンを作りたいとなったら、とても簡単にできます:
7979

8080
```html
8181
<p>
82-
<!-- you can pass in a smaller `width` and `height` as props -->
82+
<!-- より小さい `width` `height` をプロパティとして渡せます -->
8383
<icon-base width="12" height="12" icon-name="write"><icon-write /></icon-base>
84-
<!-- or you can use the default, which is 18 -->
84+
<!-- あるいはデフォルトも使えます。デフォルトは 18 です -->
8585
<icon-base icon-name="write"><icon-write /></icon-base>
86-
<!-- or make it a little bigger too :) -->
86+
<!-- または少し大きくすることも :) -->
8787
<icon-base width="30" height="30" icon-name="write"><icon-write /></icon-base>
8888
</p>
8989
```
9090

9191
<img src="/images/editable-svg-icons-sizes.png" width="450" />
9292

93-
## Animatable Icons
93+
## アニメーション可能なアイコン
9494

95-
Keeping icons in components comes in very handy when you'd like to animate them, especially on an interaction. Inline SVGs have the highest support for interaction of any method. Here's a very basic example of an icon that's animated on click:
95+
アイコンをコンポーネントに入れておくと、特にインタラクションによってアニメーションさせたいときにとても便利です。インライン SVG は、いろいろなやり方の中で最もインタラクションをサポートします。これはクリックでアニメーションするアイコンのとても基本的な例です:
9696

9797
```html
9898
<template>
@@ -141,27 +141,27 @@ export default {
141141
}
142142
```
143143

144-
We're applying `refs` to the groups of paths we need to move, and as both sides of the scissors have to move in tandem, we'll create a function we can reuse where we'll pass in the `refs`. The use of GreenSock helps resolve animation support and `transform-origin` issues across browser.
144+
移動する必要のあるパスのグループに `refs` を適用します。また、はさみの両側は連動して動く必要があるので、 `refs` を渡す再利用可能な関数を作成します。 GreenSock を使うとアニメーションのサポートや、ブラウザ間の `transform-origin` の問題を解決することができます。
145145

146146
<common-codepen-snippet title="Editable SVG Icon System: Animated icon" slug="dJRpgY" :preview="false" :editable="false" version="2" theme="0" />
147147

148148
<p style="margin-top:-30px">Pretty easily accomplished! And easy to update on the fly.</p>
149149

150-
You can see more animated examples in the repo [here](https://github.com/sdras/vue-sample-svg-icons/)
150+
他のアニメーションの例は、 [こちらの](https://github.com/sdras/vue-sample-svg-icons/) リポジトリで見ることができます。
151151

152-
## Additional Notes
152+
## 補足
153153

154-
Designers may change their minds. Product requirements change. Keeping the logic for the entire icon system in one base component means you can quickly update all of your icons and have it propagate through the whole system. Even with the use of an icon loader, some situations require you to recreate or edit every SVG to make global changes. This method can save you that time and pain.
154+
デザイナーの考えは変わるかもしれません。製品要件は変わります。アイコンシステム全体のロジックを 1 つの基本となるコンポーネントにまとめておけば、すべてのアイコンを素早く更新して、システム全体に広めることができます。アイコンローダーを使っても、場合によってはグローバルな変更を行うために、すべての SVG を再作成または編集しなければなりません。この方法ならば、そのような時間と苦痛からあなたを救うことができます。
155155

156-
## When To Avoid This Pattern
156+
## このパターンを回避するケース
157157

158-
This type of SVG icon system is really useful when you have a number of icons that are used in different ways throughout your site. If you're repeating the same icon many times on one page (e.g. a giant table with a delete icon in each row), it might make more sense to have all of the sprites compiled into a sprite sheet and use `<use>` tags to load them.
158+
このような SVG アイコンシステムは、サイト全体にさまざまな方法で使われているアイコンがたくさんある場合にとても便利です。1 つのページで同じアイコンを繰り返し使うならば(例えば、各行に削除アイコンのある巨大なテーブル)、すべてのスプライトをスプライトシートにコンパイルして `<use>` タグで読み込むほうが合理的でしょう。
159159

160-
## Alternative Patterns
160+
## 代替パターン
161161

162-
Other tooling to help manage SVG icons includes:
162+
SVG アイコンを管理するのに役立つ他のツールには、以下のものがあります:
163163

164164
- [svg-sprite-loader](https://github.com/kisenka/svg-sprite-loader)
165165
- [svgo-loader](https://github.com/rpominov/svgo-loader)
166166

167-
These tools bundle SVGs at compile time, but make them a little harder to edit during runtime, because `<use>` tags can have strange cross-browser issues when doing anything more complex. They also leave you with two nested `viewBox` properties and thus two coordinate systems. This makes the implementation a little more complex.
167+
これらのツールはコンパイル時に SVG をバンドルしますが、実行時にそれらを編集することが少し難しくなります。これは `<use>` タグが複雑な処理をする際に、おかしなクロスブラウザの問題を引き起こす可能性があるからです。2 つの入れ子になった `viewBox` プロパティがあるために、2 つの座標系が存在します。このため実装が少し複雑になります。

0 commit comments

Comments
 (0)