ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Add support for DisplayContext

Open sffc opened this issue 6 years ago • 13 comments
trafficstars

ICU has a concept called "DisplayContext", which controls the capitalization rules for display names, dates, and numbers. We should consider adding support for this across ECMA 402.

Discussion with regard to Intl.DisplayNames: https://github.com/tc39/proposal-intl-displaynames/issues/13

sffc avatar Jun 04 '19 06:06 sffc

Does this apply to other things, such as NumberFormat and DateFormat, as well?

littledan avatar Jun 25 '19 04:06 littledan

The short answer is yes; the casing, mood, etc., of all types of formatted output might depend on the context in which the output is displayed.

This feature will require investigating the variables that could affect formatted output, and then adding the option/options across most Intl formatters. We may also want to consider making this more of a first-class feature such that developers don't overlook it. Ideally, any call site to an affected formatter will declare its display context.

sffc avatar Jun 25 '19 04:06 sffc

@younies @hugovdm This could be something to consider along with the inflections work you are doing ("Project Morpheus").

sffc avatar Sep 23 '19 04:09 sffc

+1 to this feature from an internal client. The client is using Closure Templates and goog.i18n.DateTimeFormat to format dates. They reported:

During the localization testing, we found that the months are not capitalized in NL, PL and FR. ... Our linguist says that even though the months in these languages should not be capitalized when they appear within a sentence, they should be capitalized when they appear stand-alone in a list, where other words are capitalized.

internal cross-reference: http://yaqs/eng/q/5813676027281408

sffc avatar Mar 17 '20 23:03 sffc

I'm confused. Are you linking your internal company's URL to a public spec repo?

zbraniecki avatar Mar 17 '20 23:03 zbraniecki

I'm confused. Are you linking your internal company's URL to a public spec repo?

Yes? It's a useful cross-reference to help prioritize which potential spec features are important to users, just like you cross-referenced this issue to a Fluent issue above. (The internal issue relates to the lack of this feature in goog.i18n)

sffc avatar Mar 17 '20 23:03 sffc

It's a useful cross-reference to help prioritize which potential spec features are important to users, just like you cross-referenced this issue to a Fluent issue above.

I fundamentally disagree.

Referencing a public source maintains the cross-reference accessible to all contributors in a public resource. Referencing non-public resource generates two-level model with some contributors having access to additional information that may be relevant to the issue and in result creating a situation where contributing to the project is unequal or even discouraged for people who read through a thread like this and can't get the full picture due to lack of access to some of the resources referenced.

If we disagree on this, it likely is not the best place to discuss it, and I'll file a separate issue to continue this conversation.

zbraniecki avatar Mar 17 '20 23:03 zbraniecki

I added additional context to my post. The internal link is intended only as a cross-reference; I always endeavor to include all information relevant to the committee's decision-making.

(If you don't mind, I'll minimize these comments now)

sffc avatar Mar 17 '20 23:03 sffc

During the localization testing, we found that the months are not capitalized in NL, PL and FR. ... Our linguist says that even though the months in these languages should not be capitalized when they appear within a sentence, they should be capitalized when they appear stand-alone in a list, where other words are capitalized.

Interesting. I can only speak for Polish but I'd challenge that linguist. In Polish, names of months are always not capitalized. Standalone and in the middle of the sentence. They should only be capitalized at the beginning of a sentence.

That, of course, may be different for other affected locales and doesn't discount the value of displayContext - just pointing out that standalone/sentence is not all, we'll likely need at least standalone/middle-of-the-sentence/beginning-of-the-sentence.

zbraniecki avatar Mar 17 '20 23:03 zbraniecki

In this case, let's consider which parts of display context might be handled by a separate title case proposal.

littledan avatar May 01 '20 23:05 littledan

The main problem that DisplayContext solves is that which capitalization scheme to apply is function- and locale-dependent. For example, in some locales, you might titlecase month names, but in other locales, you display them in lowercase.

@macchiati has been a big advocate for using DisplayContext more universally across the board, and bubbling it through the hierarchy of formatters.

sffc avatar May 02 '20 02:05 sffc

@sffc This seems important to understand. I'm missing background in this area. Do you have any recommendations for where to read about the motivation for this effort, and why it doesn't "decompose" into case conversion routines?

littledan avatar May 02 '20 09:05 littledan

TG2 discussion: https://github.com/tc39/ecma402/blob/main/meetings/notes-2024-10-24.md#displaycontext

sffc avatar Oct 25 '24 02:10 sffc