Coder Social home page Coder Social logo

Comments (8)

septs avatar septs commented on September 23, 2024 1

I think it needs to be with https://github.com/tc39/proposal-Number.range having the same opening and closing interval semantics
CC @Jack-Works

from proposal-intl-numberformat-v3.

littledan avatar littledan commented on September 23, 2024

I can understand why someone might want to play with collapse, but I don't really have much of a sense of whether such manipulations make sense across locales (given the existing locale-dependent variation in how AUTO works). Do we have any experience we can build on from ICU's users?

I'm having trouble understanding when you'd want to mess with identityFallback. Does anyone have a use case in mind? Approximately SGTM.

from proposal-intl-numberformat-v3.

sffc avatar sffc commented on September 23, 2024

FYI: with AUTO in ICU, the decision on whether to collapse prefixes/suffixes could depend on the locale, but also on the symbols. For example:

  • $3 - $5
  • 3 - 5 CHF

However, an implementation could choose to use different results:

  • $3 - 5
  • 3 CHF - 5 CHF

from proposal-intl-numberformat-v3.

sffc avatar sffc commented on September 23, 2024

Tentative conclusion from 402 meeting:

  • Use AUTO as the default for collapse, and don't include it in the options bag. Wait for specific user demand for other options in the future. Write the spec in a way such that it's easy to implement AUTO without ICU's heuristic.
  • Use SINGLE_VALUE as the default for identityFallback, and also don't include it in the options bag. This is the behavior for identity fallback in Intl.DateTimeFormat. Consider adding approximately as a new NumberFormat-wide option, either in this proposal or a follow-on proposal.

from proposal-intl-numberformat-v3.

sffc avatar sffc commented on September 23, 2024

Relevant CLDR ticket: https://unicode-org.atlassian.net/browse/CLDR-11431

from proposal-intl-numberformat-v3.

sffc avatar sffc commented on September 23, 2024

I would like to consider a world in which we have signDisplay: "approximately". Here is what the semantics could look like here:

let nf = new Intl.NumberFormat("en" /* , { signDisplay: "auto" } */);
nf.format(-3);  // "-3"
nf.format(3);  // "3"
nf.formatRange(3, 5);  // "3 – 5"
nf.formatRange(3, 3);  // "~3"

let nf = new Intl.NumberFormat("en", { signDisplay: "approximately" });
nf.format(-3);  // RangeError
nf.format(3);  // "~3"
nf.formatRange(3, 5);  // "3 – 5"
nf.formatRange(3, 3);  // "~3"

let nf = new Intl.NumberFormat("en", { signDisplay: "negative" });
nf.format(-3);  // "-3"
nf.format(3);  // "3"
nf.formatRange(3, 5);  // "3 – 5"
nf.formatRange(3, 3);  // "3"

In this frame of reference, I think it might be okay to allow APPROXIMATELY to be the default identity fallback behavior in formatRange.

See also #10 and #17

from proposal-intl-numberformat-v3.

Jack-Works avatar Jack-Works commented on September 23, 2024

@septs intl range doesn't have same semantics with programmatic number range.
When you say "0 to 100" you're definitely including 100 but when you creating a range for programmatic use, you may want to exclude the bound.

from proposal-intl-numberformat-v3.

sffc avatar sffc commented on September 23, 2024

I don't believe there is anything actionable remaining on this ticket. We decided in #6 (comment) to not bubble up the two range formatting options from ICU. Discussion on the approximately sign is covered in #10. I will therefore close this issue.

from proposal-intl-numberformat-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.