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

Need Support for "accounting" type in NumberFormat #186

Closed
zincli opened this issue Oct 17, 2017 · 14 comments
Closed

Need Support for "accounting" type in NumberFormat #186

zincli opened this issue Oct 17, 2017 · 14 comments
Labels
c: numbers Component: numbers, currency, units s: in progress Status: the issue has an active proposal

Comments

@zincli
Copy link

zincli commented Oct 17, 2017

We have a project in south Asia, met the vi, it has two type for currency format, here's the rule in cldr.

There is an "accounting" type in currency formatting according to these documents:

And this is supported by icu4j.

So I'm thinking that we could have this supported in Intl.NumberFormat.

@rxaviers
Copy link
Member

OMG. This is not supported!? We need a new currencyDisplay value "accounting".

@littledan
Copy link
Member

Related, complementary feature request: #95

@jungshik
Copy link

Isn't this a subset of #95 ? 'accounting' is 'financial' in #95, isn't it?

@jungshik
Copy link

Scrap the previous comment. It's different. Anyway, this issue can be folded to #95 unless we want to make a focused fix for 'accounting' type only here.

@sffc
Copy link
Contributor

sffc commented Oct 23, 2017

Hi all,

My name is Shane, and I've spent a lot of time working on number formatting in the context of ICU. I met Zibi at the Unicode Conference last week, and I'd like start looking at some of these number formatting tickets in ECMA 402. I think rather than fixing each one individually, the end result would be more cohesive if we had one "number formatting" proposal for ECMA 402 that covers most of the desired use cases:

I'd like to have a draft put together in the November/December time frame.

Shane

@zbraniecki
Copy link
Member

Shane, that sounds awesome!

I'm not sure why you placed #32 in it - at least in our plans this is not a part of NumberFormat, but a separate UnitFormat, but since it's still in design phase, we have time to revisit this if you believe it's better to combine those together.

@sffc
Copy link
Contributor

sffc commented Oct 26, 2017

About Units: Conceptually, you can think of units as a modifier on a number, much like notation, rounding strategy, and whether to use grouping separators. There's no reason you shouldn't be able to combine all of these options together. Examples for illustration purposes:

new Intl.NumberFormat("en", {
  useGrouping: true,
  minimumFractionDigits: 4,
  unit: "meter"
}).format(9182736.45);  // => "9,182,736.4500 m"

new Intl.NumberFormat("en", {
  notation: "compact",  // #37
  width: "wide",
  unit: "mile"
}).format(9182736.45);  // => "9.2 million miles"

new Intl.NumberFormat("en", {
  notation: "scientific",  // #164
  unit: "gram"
}).format(9182736.45);  // => "9.2E6 g"

With UnitFormat being a separate concept, you lose a lot of interesting ways to combine it with the other options on NumberFormat. You could add an option to UnitFormat that lets you nest NumberFormat options, but I think it is worth considering whether it would be more elegant if all the number-related options were in one place.

@caridy
Copy link
Contributor

caridy commented Oct 26, 2017

@sffc anything that we can do to help you, just let us know ;)

@littledan
Copy link
Member

@sffc It's really great to have all this information about what is important for you.

I'd like to have a draft put together in the November/December time frame.

If you want to handle this yourself, I'm fine to leave it to you. However, I'm available to help if it'd be useful.

I put something on the agenda for the November meeting (Nov 28-30) to add additional options to existing formatters. This should handle the first 5 things you're mention (except for precision); all 5 of these should be relatively straightforward to specify, and also the part on the JS engine side should be straightforward (passing through options, or upgrading to ICU with an improved full precision formatter).

For skeletons, compact notation and unit formatting: these are a little more complex. I did put UnitFormat on the agenda for the next meeting, but I was planning on just doing more to justify the current design; I didn't have ideas about the kinds of changes you're suggesting. I don't have enough background to know what would be appropriate for these questions.

If there's any way I could help (e.g., with writing or editing the spec text; an obscure task in itself which is a little different from i18n domain knowledge that you have more of), let me know. If you want to physically attend a TC39 meeting, I can also help you with the arrangements. I was thinking of doing so far is propose spec text for the first 5 bullet points; do you prefer to do that yourself instead?

@littledan
Copy link
Member

@sffc I don't know where your project is, and I don't want to do anything to contradict your direction. If you want these to be part of a single, integrated project, let's work together to have something by the January meeting, and I'll remove things from the agenda which overlap significantly.

@sffc
Copy link
Contributor

sffc commented Nov 19, 2017

My current status: at Google we are studying the coverage between Closure i18n and ECMA 402, with the hope that Closure may one day be able to wrap over ECMA 402 and reduce the data footprint. This will help inform our priorities in terms of features that are most important to propose for ECMA 402. Number formatting is going to be a part of that, of course.

@littledan
Copy link
Member

That's great to hear. Would you be interested in having a VC some time to discuss the project and strategy for moving this thorough the standards process?

@littledan littledan added the Small Smaller change solvable in a Pull Request label Dec 13, 2017
@littledan
Copy link
Member

littledan commented Oct 14, 2018

Seems like this is being pursued as part of the https://github.com/sffc/proposal-unified-intl-numberformat proposal

@sffc sffc added s: in progress Status: the issue has an active proposal c: numbers Component: numbers, currency, units and removed Small Smaller change solvable in a Pull Request labels Mar 19, 2019
@sffc
Copy link
Contributor

sffc commented Mar 20, 2020

Unified NumberFormat has been merged. Closing as Fixed.

@sffc sffc closed this as completed Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: numbers Component: numbers, currency, units s: in progress Status: the issue has an active proposal
Projects
None yet
Development

No branches or pull requests

7 participants