FrontendDeveloper.in

Vue.js question detail

How do you handle Pluralization?

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().

First you need to define the messages,

const messages = {
en: {
user: 'user | users',
friend: 'no friend | one friend | {count} friends'
}
}

And the template can configure the messages with values

Finally it outputs the result as below

Back to all Vue.js questions
Get LinkedIn Premium at Rs 399