Pluralization and Linked Messages
Plural rules @:key|@:key syntax, count-based plural, linked messages with @:path.
Counting Is Language-Specific
"1 item" but "5 items" — and other languages have even more forms. Hardcoding plurals leads to awkward strings like "5 item(s)". Vue I18n has built-in pluralization to pick the right form for a count.
Pipe-Separated Plural Forms
Write the forms in one message string separated by the pipe (|) character. For English, two or three forms are typical.
const en = {
items: "no items | one item | {count} items",
}All lessons in this course
- vue-i18n Setup and Message Files
- useI18n Composable and t() Function
- Pluralization and Linked Messages
- Number, Date, and Currency Formatting