Skip to content

What settings to include for range formatting? #6

@sffc

Description

@sffc

ICU4J has a number of settings for range formatting:

https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/number/NumberRangeFormatterSettings.html

collapse

Sets the aggressiveness of "collapsing" fields across the range separator. Possible values:

  • ALL: "3-5K miles"
  • UNIT: "3K - 5K miles"
  • NONE: "3K miles - 5K miles"
  • AUTO: usually UNIT or NONE, depending on the locale and formatter settings

The default value is AUTO.

identityFallback

Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are passed to the formatRange function, or if different numbers are passed to the function but they become the same after rounding rules are applied. Possible values:

  • SINGLE_VALUE: "5 miles"
  • APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before rounding was applied
  • APPROXIMATELY: "~5 miles"
  • RANGE: "5-5 miles" (with collapse=UNIT)

The default value is APPROXIMATELY.

Do we want to add those options to ECMA-402, or just stick with the defaults?

@romulocintra

Metadata

Metadata

Assignees

No one assigned

    Labels

    designNeeds design work to make progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions