tc39/ecma402

Add option to use variant era names

Opened this issue · 1 comments

The Intl.DateTimeFormat() constructor’s era option causes the formatted date to include the default form of an era name. CLDR allows locales to specify a “variant” form. For example, in English, the default forms are “BC” and “AD”, while the variant forms are “BCE” and “CE”. In some other languages, secular equivalents to “BCE” and “CE” are the default, while the variants are for some other synonym. The use of the non-secular forms can be awkward in some academic contexts or even offensive in some religious contexts.

As far as I can tell, the Internationalization API does not provide access to these variant forms, but it would be useful as an option for some applications. For example, the OpenHistoricalMap project has been maintaining translations of “BCE” and “CE”. In order to localize date formats using Intl.DateTimeFormat, it’ll need to use formatToParts() to splice out and replace the default era names with the translated variant era names: OpenHistoricalMap/issues#626 (comment).

Based on CLDR’s LDML syntax, perhaps it would be reasonable to add an option alongside era like eraForm that can be set to either default or variant.

TG2 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2023-12-14.md#add-option-to-use-variant-era-names-845

We will revisit when Temporal, Era Code, and Era Display are all landed.