Open Bug 1482269 Opened 6 years ago Updated 3 months ago

JS Context should separate default locale for pluralrules/collation from datetime/number

Categories

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

enhancement

Tracking

()

Tracking Status
firefox63 --- affected

People

(Reporter: freaktechnik, Unassigned)

References

(Blocks 1 open bug)

Details

Currently the Intl (and toLocale*String) APIs in content all use the app locale. This means that numbers and dates are not formatted in the regional preference locale if the two don't match. The context should use LocaleService::RegionalPrefsLocale for DateTimeFormat and NumberFormat; LocaleService::AppLocale for PluralRules and Collator. It's unclear what should happen with ListFormat and RelativeTimeFormat. This exposes an additional parameter about the user, that can expose a very specific user, since some combinations will be rather rare (like in my case en-US with de-CH). I personally expect websites to be able to show me dates, numbers etc. in the format that I chose, since that's what the API enables them, else they could just use the accept-language I send them to format things (and server-side rendering will usually result in that). A big shout out to :gandalf for taking time and figuring this out over IRC with me!
Having different default locales for different Intl service constructors will require a spec change in ECMA-402, because right now the default locale [1] doesn't differentiate between which service constructor called it. [1] https://tc39.github.io/ecma402/#sec-defaultlocale
Priority: -- → P3
Severity: normal → S3

Anba: I see issue 257 got resolved at ECMA-402; My read of the issue is that this should be closed as WONTFIX, but I'd love your eyes on this.

Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
You need to log in before you can comment on or make changes to this bug.