0Pricing
Vue Academy · Lesson

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

  1. vue-i18n Setup and Message Files
  2. useI18n Composable and t() Function
  3. Pluralization and Linked Messages
  4. Number, Date, and Currency Formatting
← Back to Vue Academy