vue-i18n
vue-i18n copied to clipboard
Set number format for different locale than current
trafficstars
Clear and concise description of the problem
I have a shop that sells to EU countries. All of the EU countries use the same number format: 1.150,00 €
My main website is in German (locale: de), but I want to add an english translation (locale: en) for all other countries. By doing that, the number format now changes to €1,150.00 which is a number format no one would ever use.
How can I set the the format to be e.g. german for the english locale?
My current config:
const numberFormats = {
currency: {
style: 'currency',
currency: 'EUR',
},
};
export default defineI18nConfig(() => ({
numberFormats: {
de: numberFormats,
en: numberFormats,
},
);
I assume that this will create new Intl.NumberFormat('de', numberFormats); and new Intl.NumberFormat('en', numberFormats); but the en one I want to replace with also 'de'.
Suggested solution
Alternative
No response
Additional context
No response
Validations
- [X] Read the Contributing Guidelines
- [X] Read the Documentation
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.