Firefox not using OS-provided locale when FF and OS languages match

RESOLVED WONTFIX

Status

()

Firefox
Untriaged
RESOLVED WONTFIX
6 months ago
6 months ago

People

(Reporter: takatomatsuki, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170622104007

Steps to reproduce:

OS: Windows 7 x64
OS locale: "English (Australia)"
Firefox locale: "English (US)"
example of code: new Date().toLocaleString();


Actual results:

"6/26/2017, 10:01:47 PM"


Expected results:

"26/06/2017 10:01:47 PM"


I have also tried installing "English (British)" but the result returns the time in 24-hour format.

Issue is new to Firefox 55. Previous versions returned the expected string.
Ah, content Locale. Yes. We follow browsers locale choice, not OS.
For chrome code (Firefox UI for example) we have an API that picks OS regional settings, but at the moment JavaScript ECMA402 does not provide any API for that.

We're discussing different proposals on her w to solve it but for the moment this is a won't fix.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 months ago
Resolution: --- → WONTFIX
(Reporter)

Comment 2

6 months ago
Yes I should clarify the UI does appear to use the OS locale settings (Adblock Plus filter update dates for example), it's javascript that doesn't. 

I'm confused as to why the change to the javascript locale was made given that it has been working user and developer-friendly for so many years. I realise Chrome doesn't follow it but Firefox shouldn't drop support for features just because Chrome doesn't support it. 

These are some values from Internet Explorer 11 in Windows 7 which seems to work perfectly for javascript localisation
new Date().toLocaleString();
"‎30‎/‎06‎/‎2017‎ ‎10‎:‎50‎:‎55‎ ‎AM"
navigator.language
"en-AU"
navigator.browserLanguage
"en-US"
navigator.systemLanguage
"en-AU"
navigator.userLanguage
"en-AU"

It looks like IE11 has a language setting that has been populated with "English (Australia)" and syncs with the OS setting, while Chrome and Firefox 55+'s language setting set to English (Australia) doesn't change the javascript handling.



Firefox should use the same logic for javascript as it does for the UI. If the browser and OS language match (en-* OS and en-* browser), use the OS locale (en-AU). If the browser and OS language don't match (en-* browser and fr-* OS), use the browser's locale (en-US/en-GB/en-SA depending on what the user installed)
> Yes I should clarify the UI does appear to use the OS locale settings (Adblock Plus filter update dates for example), it's javascript that doesn't. 

Because we can look into OS for our chrome Intl, but we can't for content Intl :(

> I'm confused as to why the change to the javascript locale was made given that it has been working user and developer-friendly for so many years. I realise Chrome doesn't follow it but Firefox shouldn't drop support for features just because Chrome doesn't support it. 

The reason is that we're unifying out platform around the locale selection for the platform, not for the host environment.

Another part of the reason is the threat of fingerprinting. If the user downloads "fr" Firefox they have every right to expect that an attacker will not be able to learn the OS locale.

> Firefox should use the same logic for javascript as it does for the UI. If the browser and OS language match (en-* OS and en-* browser), use the OS locale (en-AU). If the browser and OS language don't match (en-* browser and fr-* OS), use the browser's locale (en-US/en-GB/en-SA depending on what the user installed)

That's what we do, except that we can't do this for ECMA402 just yet - I filed https://github.com/tc39/ecma402/issues/109 and I'm trying to get some consensus behind the idea of enabling this.

In such a world we would still *report* the Firefox locale, but format dates using the patterns from the OS when language matches.

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