-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add ordinal and spellout styles in NumberFormatter #22
Comments
Intl.NumberFormat has options that are decimal-specific. For example, how would you format the following?
|
For English (compact long, depends on rounding):
For English (compact short, depends on rounding):
For English:
BUT,sincerely, I think current spec for NumberFormat is... bad (unclear, tricky, complex, not optimized, etc.). I think everything which is connected to any numbers is tossed and mixed in one bag -- called Intl.NumberFormat. My opinion is that Intl.NumberFormat should be divided. My proposal is as follows:
This composition would reduce weird complexity from current NumberFormat and would enable developing new features. |
Thanks for the feedback. The all-in-one design for NumberFormat is intentional, because most of the same settings are used in all of the style options. The combination of style and notation allows for powerful combinations with a minimal learning curve. For example, the difference between It's possible that we could have gone the direction of separate formatters, but the very first version of ECMA-402 already had "currency" and "percent" as I agree that the spec is complex. I would like it to be less complex, but that will require some changes to how we deal with locale data (tc39/ecma402#210).
Actually I think "1 thousandth" makes sense here for long. For short, "1 Kth" might be acceptable. |
Thanks for your feedback too. Thanks for your commitment in this project. I hope these ideas would help to improve future web development (for web clients developers and browser developers). |
I'm going to close this issue as out of scope for this proposal, because this proposal is already at Stage 2 and adding the RBNF dependency is too big of a change. However, I have seen broad support for this feature, so I hope it can be actioned in an upcoming release of ECMA-402. Follow this thread for updates: |
Add new styles to format numbers with "ordinal" or "spell-out". Like in iOS:
https://developer.apple.com/documentation/foundation/numberformatter/style/ordinal
CLDR contains such data for locales.
The text was updated successfully, but these errors were encountered: