ecma402 icon indicating copy to clipboard operation
ecma402 copied to clipboard

Add option to use variant era names

Open 1ec5 opened this issue 2 years ago • 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: https://github.com/OpenHistoricalMap/issues/issues/626#issuecomment-1813505151.

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.

1ec5 avatar Dec 12 '23 07:12 1ec5

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.

sffc avatar Dec 15 '23 00:12 sffc