Enhance mechanism for controlling display options and results

Description

We need to expand the ways that we pass information in for formatting, and pull information out about what was formatted. We currently have some simple classes for passing information in (DisplayContext) and pulling information out (ParsePosition, FormattedValue).

LocaleDisplayNames — getInstance(ULocale locale, DisplayContext... contexts)
RelativeDateFormat, DateFormat — setContext(DisplayContext context)

But those are quite limited: for example, the DisplayContext is a flat enum that has to be passed in as a set or array, and isn’t very extensible.

  • We have long wanted, for example, to be able to pick at runtime the alternate data in CLDR, so that an application could choose the alt=”menu” or alt=”short” form of a language or country name when displaying a locale. But the user may want to have the abbreviated region but the full language such as “English (UK)”, not set all fields to short (or “menu”).

  • We will want to be able to select the grammatical case that a formatted unit of measurement should have (eg dative form in German of “3 kilograms”), so we have to have a way to do that.


See draft design doc at https://docs.google.com/document/d/1awJ3sOwXDn5cufawJvnpJUXFRn-R7er3Kl7fMDFUj40

Assignee

Mark Davis

Reporter

Mark Davis

Labels

None

Reviewer

None

Priority

major

Time Needed

None

Fix versions