tc39 / ecma402

Status, process, and documents for ECMA 402
https://tc39.es/ecma402/
Other
535 stars 104 forks source link

Add 100-kilometer unit to NumberFormat #470

Open jacobrask opened 4 years ago

jacobrask commented 4 years ago

https://github.com/unicode-org/cldr/blob/master/common/validity/unit.xml defines the 100-kilometer unit and it would be a useful addition to the list of IsSanctionedSimpleUnitIdentifier.

Vehicle manufacturers are required in many countries to specify fuel consumption in liter-per-100-kilometer which would be made possible to do natively in JavaScript with this addition.

ryzokuken commented 4 years ago

@sffc would adding 100-kilometer to #table-sanctioned-simple-unit-identifiers suffice here? And it would be a Normative change, right?

sffc commented 4 years ago

@sffc would adding 100-kilometer to #table-sanctioned-simple-unit-identifiers suffice here? And it would be a Normative change, right?

Yes and yes. However, we should be somewhat conservative in what units we add. The number of CLDR units keeps growing, and we can't simply implement all of them in ECMA-402 (ref: https://github.com/tc39/proposal-unified-intl-numberformat/issues/39#issuecomment-485048195). I would like to keep this and similar issues (e.g. #449) open to collect feedback on what units are most useful for web developers, such that we can make a stronger case to add them to browsers.

ryzokuken commented 4 years ago

Ah, I noticed the s: comment now indeed! Sure, sounds like a great plan.

sffc commented 4 years ago

Also, specifically with regard to 100-kilometer: in order to fully support vehicle fuel mileage, we need to add this unit as well as gallon-imperial, used in CA and GB. (Note that gallon and liter themselves were relatively late additions to the spec.) To me, the question is less "should we add 100-kilometer" and more "should we add vehicle fuel mileage to JavaScript"?

Also: From a socioeconomic point of view, with the rise of electric cars, if we add vehicle fuel mileage, we should consider pairing that with electric mileage and other power and energy units like kilowatt-hour. So, the question of "should we add 100-kilometer" might lead to a half dozen new units.

jacobrask commented 4 years ago

Also: From a socioeconomic point of view, with the rise of electric cars, if we add vehicle fuel mileage, we should consider pairing that with electric mileage and other power and energy units like kilowatt-hour. So, the question of "should we add 100-kilometer" might lead to a half dozen new units.

I would argue yes because the car industry is exceptionally global which means there are few cases where anyone would display this information and not internationalize it. Interest and legal requirements for comparing fuel economy between different cars is very likely to increase.

It is true though that it would not end with liters per 100 km, see this ticket I created with the CLDR.

What is the major concern around adding new units - implementation cost, increased download size for users or increased API surface?

sffc commented 4 years ago

What is the major concern around adding new units - implementation cost, increased download size for users or increased API surface?

Mainly increased download size. Most browsers still ship a single app with all locales, so adding a unit requires adding the translations into 50+ languages to the download of the browser installation package. There's a long-term effort to solve this problem by downloading locales on an as-needed basis, but that's still a work in progress. @FrankYFTang