Tweaks to number skeletons

Description

I had a few ideas for improvements that retain the space-separated token syntax:

  • Token "K" (or "k"?) as a shortcut for "notation/compact-short"

  • Token "+" as a shortcut for "sign-display-always"

  • Token "(+)" as a shortcut for "sign-display-accounting-always"

  • Token "++" as a shortcut for "sign-display-except-zero"

  • Token "(++)" as a shortcut for "sign-display-accounting-except-zero"

  • Maybe "++_" and "(++_)" for "sign[-accounting]-never"

  • Token "%" as a shortcut for "percent"

  • Allow the option argument for "unit" to have the core unit identifier (without the type prefix), like "unit/meter" instead of "unit/length-meter"

  • Possibly allow any core unit identifier to appear as a stem directly: "meter" instead of "unit/length-meter"

Example:

  • Current: ".00 notation/compact-short percent sign-display/except-zero"

  • New: "++ .00 k %"

Activity

Show:
Shane Carr
February 13, 2019, 7:17 PM

ICU-TC, 2/13/2019: If shorter syntax is added, it will be added in addition to the long-form syntax; the long-form syntax will continue to be accepted. This enables the corresponding APIs to become stable while we continue this design process.

Shane Carr
January 14, 2020, 10:54 AM
Edited

This has been merged, with changes relative to the OP of this thread. See the documentation (skeletons.md on GitHub) for the latest updates.

https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md

Shane Carr
March 9, 2020, 7:41 PM

Markus: can you review/verify that the API proposal, documentation, ICU4C, and ICU4J are consistent with each other?

Markus Scherer
March 16, 2020, 9:28 PM

API proposal:

“[approved:2019-11-13] ICU proposal: Use '*' for unlimited digits in number skeletons“

and following “[approved:2019-11-20] ICU proposal: Concise number skeleton syntax“

Assignee

Shane Carr

Reporter

Shane Carr

Components

Labels

None

Reviewer

Markus Scherer

Priority

medium

Time Needed

Hours

Fix versions

Configure