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

Add compound units like square-* or cubic-* #767

Open
hlehmann opened this issue Apr 6, 2023 · 7 comments
Open

Add compound units like square-* or cubic-* #767

hlehmann opened this issue Apr 6, 2023 · 7 comments
Labels
c: numbers Component: numbers, currency, units enhancement new unit Request for a new unit in Intl.NumberFormat s: comment Status: more info is needed to move forward

Comments

@hlehmann
Copy link

hlehmann commented Apr 6, 2023

As I undersand there were and issue of data size, that's why allowed units have been limited.

Currently there a list of allowed unit identifiers and a possibility to combine them by using the identifier -per- (ex: meter-per-second => m/s).

Could it be possible to add the same logic with "square-" and "cubic-" (ex squared-meter => m² or meter-per-squared-second => m/s²).

This would allow use of area units and volume units:

  • area units: square-centimeter square-foot square-inch square-kilometer square-meter square-mile square-yard
  • volume units: cubic-inch cubic-kilometer cubic-meter cubic-mile cubic-yard

If a generic "square-" approach is not possible, please consider adding some of square area units as there are commonly used.

@ryzokuken
Copy link
Member

Is this data already available in CLDR?

@ryzokuken ryzokuken added enhancement c: numbers Component: numbers, currency, units s: comment Status: more info is needed to move forward new unit Request for a new unit in Intl.NumberFormat labels Apr 6, 2023
@hlehmann
Copy link
Author

hlehmann commented Apr 6, 2023

@ryzokuken
Copy link
Member

ryzokuken commented Apr 6, 2023

@hlehmann perfect, so the data exists and there's demand! I would raise this in the TC39-TG2 meeting later today but generally, anything you could do to make a stronger case for the addition of these units would be wonderful. This includes (but isn't limited to) other standard libraries/popular packages supporting the use of these units, use of the units on the web in the wild, especially in contexts that utilize or could potentially benefit from localization. I think the use-cases for square-meter for example would be fairly easy to spot in real-estate related web applications (for example).

@hlehmann
Copy link
Author

hlehmann commented Apr 6, 2023

Thanks.

My main concern is mostly about square-meter and square-kilometer (and imperial units equivalents).

Any apps that have for example:

  • geographic assessment: building, land, properties, cities, countries, geographic events...
  • products with surface properties: the living area of ​​an house, the size of a product or the area covered by a product...

By searching m² or km² on the web it returns hundreds of millions page results.

@sffc
Copy link
Contributor

sffc commented Apr 8, 2023

Arbitrary unit dimensionality should be implementable with ICU with minimal data size impact.

@jrnail23
Copy link

jrnail23 commented Aug 25, 2023

@ryzokuken, our app showcases event venues, including their floor plans and event space measurements. We'd really love to have support for square feet and square meters for those use cases. We're currently localizing our app, and we're having to implement this ourselves.

@ray007
Copy link

ray007 commented Aug 25, 2023

Sounds like an exponent parameter to me.

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 enhancement new unit Request for a new unit in Intl.NumberFormat s: comment Status: more info is needed to move forward
Projects
None yet
Development

No branches or pull requests

5 participants