You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -215,6 +215,7 @@ List of 300 VueJS Interview Questions
215
215
|206|[What is Vue I18n plugin?](#what-is-vue-i-8n--plugin)|
216
216
|207|[#What are the types of formatting?](#what-are-the-types-of-formatting)|
217
217
|208|[What is custom formatting?](#what-is-custom-formatting)|
218
+
|209|[How do you handle Pluralization?](#how-do-you-handle-pluralization)|
218
219
219
220
1.### What is VueJS?
220
221
**Vue.js** is an open-source, progressive Javascript framework for building user interfaces that aim to be incrementally adoptable. The core library of VueJS is focused on the `view layer` only, and is easy to pick up and integrate with other libraries or existing projects.
@@ -3692,3 +3693,34 @@ List of 300 VueJS Interview Questions
3692
3693
// Run!
3693
3694
newVue({ i18n }).$mount('#app')
3694
3695
```
3696
+
209. ### How do you handle Pluralization?
3697
+
You can translate with pluralization by defining the locale that have a pipe | separator, and define plurals in pipe separator. Remember that template should use $tc() instead of $t().
3698
+
First you need to difine the messages,
3699
+
```javascript
3700
+
constmessages= {
3701
+
en: {
3702
+
user:'user | users',
3703
+
friend:'no friend | one friend | {count} friends'
3704
+
}
3705
+
}
3706
+
```
3707
+
And the template can configure the messages with values
0 commit comments