kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js

Home Page:https://kazupon.github.io/vue-i18n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid duplicate code for `numberFormats` and `dateTimeFormats `

MickL opened this issue · comments

Clear and concise description of the problem

Currently numberFormats and dateTimeFormats need to be set for each language separately:

numberFormats: {
    de: {
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    },
    nl: {
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    es: {
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    },
    fr: {
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    },
    pt: {
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    },
  },

This results in duplicate code for countries that share the same currency or date-time-format (common within in the EU).

Suggested solution

It would be nice to group them somehow, for example:

numberFormats: [
    {
      locales: ['de', 'nl', 'es', 'fr', 'pt'],
      currency: {
        style: 'currency',
        currency: 'EUR',
      },
    },
  ],

Or in some other way.

Alternative

No response

Additional context

No response

Validations