Skip to content

Combining both pluralisation and number/currency formatting? #501

Answered by kazupon
mjog asked this question in Q&A
Discussion options

You must be logged in to vote

You can solve this using the $t and $n API.

message:

{
  "msg": {
    "units": "You have 0 units remaining | You have 1 unit remaining | You have {unit} units remaining"
  }
}

usage example:

$t('msg.units', 100000, { named: { unit: $n(100000) } })

about $t API details:
https://vue-i18n.intlify.dev/api/injection.html#t-key-plural-options

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mjog
Comment options

@kazupon
Comment options

Answer selected by mjog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants