vue-i18n icon indicating copy to clipboard operation
vue-i18n copied to clipboard

Set number format for different locale than current

Open MickL opened this issue 1 year ago • 0 comments
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

MickL avatar Oct 22 '24 17:10 MickL