Comments (8)
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.
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.
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.
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.
Relevant CLDR ticket: https://unicode-org.atlassian.net/browse/CLDR-11431
from proposal-intl-numberformat-v3.
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.
from proposal-intl-numberformat-v3.
@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.
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)
- Intl.PluralRules does not have the [[RoundingMode]] internal slot required by FormatNumericToString HOT 2
- `formatRangeToParts` produces an empty `source` when `FormatApproximately` is used HOT 2
- FormatNumericToString - isNegative first value clarification HOT 2
- Ordinal formating in NumberFormat HOT 2
- useGrouping's Note is inconsistent with the actual code HOT 1
- ResolvePluralRange does not account for approximately formatted ranges HOT 2
- Clarify that literals can be changed in CollapseNumberRange
- Should "approximatelySign" be renamed to "approximateSign"? HOT 1
- Can the order in which properties are read be more comprehensible? HOT 8
- Can ToRawPrecision and ToRawFixed be made more deterministic? HOT 1
- String(Intl)MV should be defined in ECMA-262 HOT 2
- `FormatNumericToString` will errantly convert -0 to +0 then back to -0 before calling `ToRaw[Precision|Fixed]` HOT 1
- Missing 𝔽 subscript for -0 in FormatNumericToString
- Meta: cross-references are gone
- Simplify PartitionNumberRangePattern
- Hard time to implement IntlMathematicalValue HOT 12
- Clarification on what "precision" means in roundingPriority: morePrecision/lessPrecision HOT 4
- Only passing `roundingIncrement` will throw an error. HOT 3
- Limit exponent of intl mathematical value HOT 7
- Lack of [[Source]] in FormatNumericRangeToParts if returned by FormatApproximately HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proposal-intl-numberformat-v3.