Skip to content
New issue

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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant