Skip to content

Commit b01df6e

Browse files
authored
Added pluralization example to custom directive page (#1084)
1 parent d7f1de8 commit b01df6e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/guide/advanced/directive.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,26 @@ const i18n = createI18n({
6363
en: {
6464
message: {
6565
hi: 'Hi, {name}!',
66-
bye: 'good bye!'
66+
bye: 'good bye!',
67+
apple: 'no apples | one apple | {count} apples'
6768
}
6869
},
6970
ja: {
7071
message: {
7172
hi: 'こんにちは、 {name}!',
72-
bye: 'さようなら!'
73+
bye: 'さようなら!',
74+
apple: 'リンゴはありません | 一つのりんご | {count} りんご'
7375
}
7476
}
7577
}
7678
})
7779

7880
const app = createApp({
7981
data() {
80-
return { byePath: 'message.bye' }
82+
return {
83+
byePath: 'message.bye',
84+
appleCount: 7,
85+
}
8186
}
8287
})
8388
app.use(i18n)
@@ -92,6 +97,8 @@ Templates:
9297
<p v-t="{ path: 'message.hi', args: { name: 'kazupon' } }"></p>
9398
<!-- data binding via data -->
9499
<p v-t="{ path: byePath, locale: 'en' }"></p>
100+
<!-- pluralization -->
101+
<p v-t="{ path: 'message.apple', plural: appleCount }"></p>
95102
</div>
96103
```
97104

@@ -101,6 +108,7 @@ Outputs:
101108
<div id="object-syntax">
102109
<p>こんにちは、 kazupon!</p>
103110
<p>good bye!</p>
111+
<p>7 りんご</p>
104112
</div>
105113
```
106114

0 commit comments

Comments
 (0)