Open Bug 1720480 Opened 3 years ago Updated 3 years ago

Consider enabling exemplar cities again

Categories

(Core :: JavaScript: Internationalization API, enhancement, P2)

enhancement

Tracking

()

ASSIGNED
Tracking Status
firefox92 --- affected

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(2 files)

Exemplar cities data was removed in bug 1225401, but is now useful to generate better data for bug 1710429.

ICU uses the following strategy to implement the "{short,long}Generic" time zone name:

  1. If a generic name (key "lg" resp. "sg" in the data file) is available, use it directly.
  2. Else fall back to either
    1. using the country name when the time zone is the country's primary time zone.
    2. otherwise use the exemplar city name and if the exemplar city name isn't available, derive the city name through this fallback path.

Examples:

Locale Time zone Short Generic
de America/North_Dakota/Center Center Zeit
en Antarctica/DumontDUrville DumontDUrville Time
zh America/Los_Angeles Los Angeles时间

When exemplar city names are available:

Locale Time zone Short Generic
de America/North_Dakota/Center Center, North Dakota Zeit
en Antarctica/DumontDUrville Dumont d’Urville Time
zh America/Los_Angeles 洛杉矶时间
Severity: -- → N/A
Priority: -- → P2

The test data was incorrectly using an object where multiple entries had the
same key. Switch the data to use an array and then fix up any incorrect
entries.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

This adds 700kb to the ICU data file, but gives better results for the
"shortGeneric" time zone name option, because it's now using the localised
name of the city instead of deriving the city name from the time zone id.

Depends on D121893

Hi Anba, I'm concerned about the 700kb payload increase and I raised it with the ECMA-402. The group believes that we should not make this change and Frank (V8) said he's not planning to do that there.

I filed an issue and Shane plans to summarize the outcome of the discussion there: https://github.com/tc39/ecma402/issues/599

Anba - would you be comfortable dropping the exemplar cities PR based on Frank's response in https://github.com/tc39/proposal-intl-extend-timezonename/issues/12#issuecomment-898054202 ?

Flags: needinfo?(andrebargull)

V8 drops exemplar cities from their ICU data file, so they're in the same boat as we are, where ICU will derive the city name from the time zone identifier string itself. (Literally the time zone identifier string!) This can be seen with this example:

["short", "long", "shortGeneric", "longGeneric"].forEach(timeZoneName => {
  console.log(new Intl.DateTimeFormat("ru", {timeZone: "Europe/Moscow", timeZoneName}).format(0));
})

Prints in both V8 and SpiderMonkey:

01.01.1970, GMT+3
01.01.1970, Москва, стандартное время
01.01.1970, Moscow
01.01.1970, Москва, стандартное время

With exemplar city data available, the third entry will change from "Moscow" to "Москва".

Flags: needinfo?(andrebargull)

Safari's implementation (currently in progress at https://bugs.webkit.org/show_bug.cgi?id=227831) will most likely print "Москва", because AFAIK Safari doesn't perform any data trimming.

And FWIW I've tried to minimise the number of exemplar city data which needs to be added and it seems it's possible to reduce the overhead to ~300 KB.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: