8000 Include number formatting data in the bundled ICU data · Issue #11888 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Include number formatting data in the bundled ICU data #11888

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

Closed
bojanz opened this issue Sep 9, 2014 · 6 comments
Closed

Include number formatting data in the bundled ICU data #11888

bojanz opened this issue Sep 9, 2014 · 6 comments

Comments

@bojanz
Copy link
bojanz commented Sep 9, 2014

ICU includes number formatting data in locales/$locale.txt.

It looks like this:

NumberElements{
        latn{
            patterns{
                currencyFormat{"¤ #0.00"}
                decimalFormat{"#0.######"}
                percentFormat{"#0%"}
                scientificFormat{"0.000000E+000"}
            }
            symbols{
                infinity{"INF"}
                perMille{"0/00"}
            }
        }
    }

Or, more nicely, in json:
https://github.com/commerceguys/intl/blob/master/resources/number_format/en.json

This data also includes the decimal and grouping separators, and the plus/minus/percent signs, if they're different from the defaults.

Having this data allows us to implement a NumberFormatter that works on all locales:
https://github.com/commerceguys/intl/blob/master/src/Formatter/NumberFormatter.php

@jakzal
Copy link
Contributor
jakzal commented Mar 22, 2016

@bojanz would you still find this data useful?

@bojanz
Copy link
Author
bojanz commented Mar 22, 2016

Yes, this data is generally very useful.

@ro0NL
Copy link
Contributor
ro0NL commented May 3, 2019

im not sure SF should compile the data, just so you can implement a NumberFormatter

for the Intl component there's already a NumberFormatter stub that only supports the "en" locale, otherwise use the real NumberFormatter. As such we dont really need the data in core, unless we decide to update the stub NumberFormatter IMHO.

Put different, it's a bit weird to compile the data, expose it in e.g. Currencies::getCurrencyFormat() but then not leverage it in our NumberFormatter stub 😕

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Could I get a reply or should I close this?

@carsonbot
Copy link

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0