We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi!
If I'm not mistaken, the currency is currently tied to the locale:
const i18n = new VueI18n({ numberFormats: { 'en-US': { currency: { style: 'currency', currency: 'USD' } }, 'fr-FR': { currency: { style: 'currency', currency: 'EUR' } } } });
So $n(100, 'currency') will print 100 € if the locale is set to fr-FR and $100 if it's en-US.
$n(100, 'currency')
100 €
fr-FR
$100
en-US
Which is problematic if a American wants to do some business in euro in France.
Reference: https://kazupon.github.io/vue-i18n/guide/number.html
I'd like to be able to set the current currency:
i18n.currency = "EUR";
So that $n(100, 'currency') returns the correct label.
If I understand correctly, there are currently two alternatives:
$n(100, { style: "currency", currency: theCurrentCurrency })
But that requires including the theCurrentCurrency variable everywhere.
theCurrentCurrency
mergeNumberFormat()
i18n.mergeNumberFormat(i18n.locale, { currency: { style: 'currency', currency: 'EUR' } });
But this requires calling mergeNumberFormat() every time the locale or the currency is updated.
Reference: https://kazupon.github.io/vue-i18n/api/#mergenumberformat-locale-format
Possibly related:
The text was updated successfully, but these errors were encountered:
Nevermind, mergeNumberFormat is totally sufficient 👍
mergeNumberFormat
Sorry, something went wrong.
No branches or pull requests
Clear and concise description of the problem
Hi!
If I'm not mistaken, the currency is currently tied to the locale:
So
$n(100, 'currency')
will print100 €
if the locale is set tofr-FR
and$100
if it'sen-US
.Which is problematic if a American wants to do some business in euro in France.
Reference: https://kazupon.github.io/vue-i18n/guide/number.html
Suggested solution
I'd like to be able to set the current currency:
So that
$n(100, 'currency')
returns the correct label.Alternative
If I understand correctly, there are currently two alternatives:
But that requires including the
theCurrentCurrency
variable everywhere.mergeNumberFormat()
But this requires calling
mergeNumberFormat()
every time the locale or the currency is updated.Reference: https://kazupon.github.io/vue-i18n/api/#mergenumberformat-locale-format
Additional context
Possibly related:
Validations
The text was updated successfully, but these errors were encountered: