Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Avoid duplicate code for numberFormats and dateTimeFormats #1694

Open
3 tasks done
MickL opened this issue Jan 24, 2024 · 1 comment
Open
3 tasks done

Avoid duplicate code for numberFormats and dateTimeFormats #1694

MickL opened this issue Jan 24, 2024 · 1 comment
Labels
Status: Proposal Request for comments

Comments

@MickL
Copy link

MickL commented Jan 24, 2024

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

@MickL MickL added the Status: Proposal Request for comments label Jan 24, 2024
@MickL
Copy link
Author

MickL commented Oct 18, 2024

I just came back here 9 months later, having the exact same issue. Now I have way more number and date formats and languages so the duplicate code is enormous. Is there any ETA maybe @kazupon ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant