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
Make it possible to explicitly specify currency when localising numbers.
Current set of arguments for $n() function looks like this:
{number} value: required
{Path | Object} key: optional
{Locale | Object} locale: optional
This makes it possible to extend the second key: Object argument by adding optional currency option, which will override default value from the numberFormats configuration.
<ulv-for="transaction in transactions"><li>{{ $n(transaction.amount, { key: 'currency', currency: transaction.currency }) }}</p><!-- Or use it even as a fallback options: <li>{{ $n(transaction.amount, { style: 'currency', 'currency': transaction.currency, currencyDisplay: 'code' }) }}</li> --></ul>
The text was updated successfully, but these errors were encountered:
bponomarenko
changed the title
Make possible to explicitly specify currency when localising numbers.
Add Feature: Make possible to explicitly specify currency when localising numbers.
Mar 3, 2018
Hi. Thanks for this plugin, it works really well for us. However there is one use case, which can't be implemented with
vue-i18n
at the moment.Use case
We need to display a list of formatted amounts in different currencies.
Data structure may look like this:
Feature request
Make it possible to explicitly specify currency when localising numbers.
Current set of arguments for
$n()
function looks like this:{number} value: required
{Path | Object} key: optional
{Locale | Object} locale: optional
This makes it possible to extend the second
key: Object
argument by adding optionalcurrency
option, which will override default value from thenumberFormats
configuration.Example of possible API
Number formats:
Template:
Expected result:
The text was updated successfully, but these errors were encountered: