Skip to content

Commit cfdd8ba

Browse files
authored
Japanese translation (Template Directives section) (#41)
1 parent 7ee1a72 commit cfdd8ba

File tree

6 files changed

+125
-125
lines changed

6 files changed

+125
-125
lines changed

.vitepress/locales/ja.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ export default {
4141
]
4242
},
4343
{
44-
text: 'Template Directives',
44+
text: 'テンプレートディレクティブ',
4545
items: [
4646
{ text: 'v-model', link: '/ja/breaking-changes/v-model' },
4747
{
48-
text: 'key Usage Change',
48+
text: 'key の使用方法の変更',
4949
link: '/ja/breaking-changes/key-attribute'
5050
},
5151
{
52-
text: 'v-if vs. v-for Precedence',
52+
text: 'v-if v-for の優先順位',
5353
link: '/ja/breaking-changes/v-if-v-for'
5454
},
55-
{ text: 'v-bind Merge Behavior', link: '/ja/breaking-changes/v-bind' },
55+
{ text: 'v-bind のマージ動作', link: '/ja/breaking-changes/v-bind' },
5656
{
57-
text: 'v-on.native modifier removed',
57+
text: 'v-on.native 修飾子の削除',
5858
link: '/ja/breaking-changes/v-on-native-modifier-removed'
5959
}
6060
]

src/ja/breaking-changes/key-attribute.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,58 @@ badges:
33
- breaking
44
---
55

6-
# `key` Attribute <MigrationBadges :badges="$frontmatter.badges" />
6+
# `key` 属性 <MigrationBadges :badges="$frontmatter.badges" />
77

8-
## Overview
8+
## 概要
99

10-
- **NEW:** `key`s are no longer necessary on `v-if`/`v-else`/`v-else-if` branches, since Vue now automatically generates unique `key`s.
11-
- **BREAKING:** If you manually provide `key`s, then each branch must use a unique `key`. You can no longer intentionally use the same `key` to force branch reuse.
12-
- **BREAKING:** `<template v-for>` `key` should be placed on the `<template>` tag (rather than on its children).
10+
- **新機能:** `v-if`/`v-else`/`v-else-if` の分岐では、Vue が自動的にユニークな `key` を生成するようになったため、`key` は不要になりました。
11+
- **破壊的変更:** 手動で `key` を指定する場合、各ブランチはユニークな `key` を使用する必要があります。ブランチの再利用を強制するために、意図的に同じ `key` を使用できなくなりました。
12+
- **破壊的変更:** `<template v-for>` `key` は(子要素ではなく)`<template>` タグに配置する必要があります。
1313

14-
## Background
14+
## 背景
1515

16-
The `key` special attribute is used as a hint for Vue's virtual DOM algorithm to keep track of a node's identity. That way, Vue knows when it can reuse and patch existing nodes and when it needs to reorder or recreate them. For more information, see the following sections:
16+
特別な属性 `key` は、Vue の仮想 DOM アルゴリズムがノードの ID を追跡するためのヒントとして使用されます。これにより、Vue は既存のノードを再利用したりパッチを当てたりできるタイミングや、ノードの並び替えや再作成が必要なタイミングを知ることができます。詳細については、下記のセクションを参照してください。
1717

18-
- [List Rendering: Maintaining State](https://ja.vuejs.org/guide/essentials/list.html#maintaining-state-with-key)
19-
- [API Reference: `key` Special Attribute](https://ja.vuejs.org/api/built-in-special-attributes.html#key)
18+
- [リストレンダリング: 状態管理](https://ja.vuejs.org/guide/essentials/list.html#maintaining-state-with-key)
19+
- [API リファレンス: 特別な属性 `key`](https://ja.vuejs.org/api/built-in-special-attributes.html#key)
2020

21-
## On conditional branches {#on-conditional-branches}
21+
## 条件分岐 {#on-conditional-branches}
2222

23-
In Vue 2.x, it was recommended to use `key`s on `v-if`/`v-else`/`v-else-if` branches.
23+
Vue 2.x では、`v-if`/`v-else`/`v-else-if` の分岐に `key` を使用することが推奨されていました。
2424

2525
```html
2626
<!-- Vue 2.x -->
2727
<div v-if="condition" key="yes">Yes</div>
2828
<div v-else key="no">No</div>
2929
```
3030

31-
The example above still works in Vue 3.x. However, we no longer recommend using the `key` attribute on `v-if`/`v-else`/`v-else-if` branches, since unique `key`s are now automatically generated on conditional branches if you don't provide them.
31+
上記の例は、Vue 3.x でも動作します。しかし、`v-if`/`v-else`/`v-else-if` の分岐で `key` 属性を使うことはもうお勧めしません。条件分岐で `key` を指定しない場合には自動的にユニークな `key` が生成されるようになったからです。
3232

3333
```html
3434
<!-- Vue 3.x -->
3535
<div v-if="condition">Yes</div>
3636
<div v-else>No</div>
3737
```
3838

39-
The breaking change is that if you manually provide `key`s, each branch must use a unique `key`. In most cases, you can remove these `key`s.
39+
今回の破壊的変更は、手動で `key` を指定した場合、各ブランチはユニークな `key` を使用しなければならないことです。ほとんどの場合、これらの `key` は削除できます。
4040

4141
```html
4242
<!-- Vue 2.x -->
4343
<div v-if="condition" key="a">Yes</div>
4444
<div v-else key="a">No</div>
4545

46-
<!-- Vue 3.x (recommended solution: remove keys) -->
46+
<!-- Vue 3.x (推奨の解決策: キーの削除) -->
4747
<div v-if="condition">Yes</div>
4848
<div v-else>No</div>
4949

50-
<!-- Vue 3.x (alternate solution: make sure the keys are always unique) -->
50+
<!-- Vue 3.x (代替策: キーを常にユニークにする) -->
5151
<div v-if="condition" key="a">Yes</div>
5252
<div v-else key="b">No</div>
5353
```
5454

55-
## With `<template v-for>` {#with-template-v-for}
55+
## `<template v-for>` での使用 {#with-template-v-for}
5656

57-
In Vue 2.x, a `<template>` tag could not have a `key`. Instead, you could place the `key`s on each of its children.
57+
Vue 2.x では、`<template>` タグは `key` を持つことができず、その代わりにそれぞれの子要素に `key` を配置できました。
5858

5959
```html
6060
<!-- Vue 2.x -->
@@ -64,7 +64,7 @@ In Vue 2.x, a `<template>` tag could not have a `key`. Instead, you could place
6464
</template>
6565
```
6666

67-
In Vue 3.x, the `key` should be placed on the `<template>` tag instead.
67+
Vue 3.x ではそうではなく、`key` `<template>` タグに配置する必要があります。
6868

6969
```html
7070
<!-- Vue 3.x -->
@@ -74,7 +74,7 @@ In Vue 3.x, the `key` should be placed on the `<template>` tag instead.
7474
</template>
7575
```
7676

77-
Similarly, when using `<template v-for>` with a child that uses `v-if`, the `key` should be moved up to the `<template>` tag.
77+
同様に、`v-if` がある子要素を持つ `<template v-for>` を使う場合、`key` `<template>` タグに移動する必要があります。
7878

7979
```html
8080
<!-- Vue 2.x -->

src/ja/breaking-changes/v-bind.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
---
2-
title: v-bind Merge Behavior
2+
title: v-bind のマージ動作
33
badges:
44
- breaking
55
---
66

77
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
88

9-
## Overview
9+
## 概要
1010

11-
- **BREAKING**: Order of bindings for v-bind will affect the rendering result.
11+
- **破壊的変更**: v-bind のバインディングの順番は、レンダリング結果に影響します。
1212

13-
## Introduction
13+
## はじめに
1414

15-
When dynamically binding attributes on an element, a common scenario involves using both the `v-bind="object"` syntax as well as individual attributes in the same element. However, this raises questions as far as the priority of merging.
15+
要素に属性を動的にバインドする場合、同じ要素で `v-bind="object"` 構文と個別の属性の両方を使用するのが一般的です。しかし、この場合、マージの優先順位に問題が生じます。
1616

17-
## 2.x Syntax
17+
## 2.x の構文
1818

19-
In 2.x, if an element has both `v-bind="object"` and an identical individual attribute defined, the individual attribute would always overwrite bindings in the `object`.
19+
2.x では、要素に `v-bind="object"` と個別の属性が定義されている場合、個別の属性は常に `object` のバインドを上書きしていました。
2020

2121
```html
22-
<!-- template -->
22+
<!-- テンプレート -->
2323
<div id="red" v-bind="{ id: 'blue' }"></div>
24-
<!-- result -->
24+
<!-- 結果 -->
2525
<div id="red"></div>
2626
```
2727

28-
## 3.x Syntax
28+
## 3.x の構文
2929

30-
In 3x, if an element has both `v-bind="object"` and an identical individual attribute defined, the order of how the bindings are declared determines how they are merged. In other words, rather than assuming developers want the individual attribute to always override what is defined in the `object`, developers now have more control over the desired merging behavior.
30+
3x では、要素に `v-bind="object"` と個別の属性が定義されている場合、バインディングが宣言されている順序によって、それらがどのようにマージされるかが決まります。つまり、`object` で定義されたものを個別の属性が常にオーバーライドすることを開発者が望んでいると想定するのではなく、必要とするマージ動作をより詳細にコントロールできるようになったのです。
3131

3232
```html
33-
<!-- template -->
33+
<!-- テンプレート -->
3434
<div id="red" v-bind="{ id: 'blue' }"></div>
35-
<!-- result -->
35+
<!-- 結果 -->
3636
<div id="blue"></div>
3737

38-
<!-- template -->
38+
<!-- テンプレート -->
3939
<div v-bind="{ id: 'blue' }" id="red"></div>
40-
<!-- result -->
40+
<!-- 結果 -->
4141
<div id="red"></div>
4242
```
4343

44-
## Migration Strategy
44+
## 移行手順
4545

46-
If you are relying on this override functionality for `v-bind`, we currently recommend ensuring that your `v-bind` attribute is defined before individual attributes.
46+
この `v-bind` のオーバーライド機能を利用している場合は、`v-bind` 属性が個別の属性より先に定義されているか確認することをお勧めします。
4747

48-
[Migration build flag: `COMPILER_V_BIND_OBJECT_ORDER`](../migration-build.html#compat-configuration)
48+
[移行ビルドのフラグ: `COMPILER_V_BIND_OBJECT_ORDER`](../migration-build.html#compat-configuration)

src/ja/breaking-changes/v-if-v-for.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
2-
title: v-if vs. v-for Precedence
2+
title: v-if v-for の優先順位
33
badges:
44
- breaking
55
---
66

77
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
88

9-
## Overview
9+
## 概要
1010

11-
- **BREAKING**: If used on the same element, `v-if` will have higher precedence than `v-for`
11+
- **破壊的変更**: 同じ要素で使用した場合、`v-if` `v-for` より優先度が高くなります
1212

13-
## Introduction
13+
## はじめに
1414

15-
Two of the most commonly used directives in Vue.js are `v-if` and `v-for`. So it's no surprise that there comes a time when developers want to use both together. While this is not a recommended practice, there may be times when this is necessary, so we wanted to provide guidance for how it works.
15+
Vue.js で最もよく使われるディレクティブは `v-if` `v-for` の 2 つです。そのため、開発者がこの 2 つを一緒に使いたいと思うことがあっても不思議ではありません。これは推奨される方法ではありませんが、必要な場合もあるため、その仕組についてのガイダンスを提供したいと考えています。
1616

17-
## 2.x Syntax
17+
## 2.x の構文
1818

19-
In 2.x, when using `v-if` and `v-for` on the same element, `v-for` would take precedence.
19+
2.x では、同じ要素に対して `v-if` `v-for` を使用した場合、`v-for` が優先されました。
2020

21-
## 3.x Syntax
21+
## 3.x の構文
2222

23-
In 3.x, `v-if` will always have the higher precedence than `v-for`.
23+
3.x では、`v-if` は常に `v-for` より優先度が高くなります。
2424

25-
## Migration Strategy
25+
## 移行手順
2626

27-
It is recommended to avoid using both on the same element due to the syntax ambiguity.
27+
構文があいまいなため、同じ要素で両方を使用することは避けることをお勧めします。
2828

29-
Rather than managing this at the template level, one method for accomplishing this is to create a computed property that filters out a list for the visible elements.
29+
これをテンプレートレベルで管理するのではなく、表示する要素のリストをフィルタリングする算出プロパティを作成することで実現する方法があります。
3030

31-
[Migration build flag: `COMPILER_V_IF_V_FOR_PRECEDENCE`](../migration-build.html#compat-configuration)
31+
[移行ビルドのフラグ: `COMPILER_V_IF_V_FOR_PRECEDENCE`](../migration-build.html#compat-configuration)
3232

33-
## See also
33+
## 参照
3434

35-
- [List Rendering - Displaying Filtered/Sorted Results](https://ja.vuejs.org/guide/essentials/list.html#displaying-filtered-sorted-results)
36-
- [List Rendering - `v-for` with `v-if`](https://ja.vuejs.org/guide/essentials/list.html#v-for-with-v-if)
35+
- [リストレンダリング - フィルタリング/並べ替えの結果を表示する](https://ja.vuejs.org/guide/essentials/list.html#displaying-filtered-sorted-results)
36+
- [リストレンダリング - `v-for` `v-if`](https://ja.vuejs.org/guide/essentials/list.html#v-for-with-v-if)

0 commit comments

Comments
 (0)