Closed Bug 1475876 Opened 6 years ago Closed 6 years ago

intl.locale.requested doesn't affect to JS locale unless Language Pack is installed

Categories

(Core :: JavaScript: Internationalization API, defect)

61 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: nobuoka, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Build ID: 20180704003137

Steps to reproduce:

1. Install Firefox for en-US (I tried on Windows 10 and Ubuntu 18.04 either)
2. Change value of pref `intl.locale.requested` to "ja"
3. Execute JS on web page or on console to check locale: `new Date().toLocaleString()`



Actual results:

The result string is not ja locale (such as "2018/7/16 4:08:05"), but en-US locale (such as "7/16/2018, 4:08:08 AM").


Expected results:

The result string should be ja locale (such as "2018/7/16 4:08:05").

I know that the result string will be ja locale if Japanese Language Pack is installed or Firefox for ja is used.
I want to know whether it is bug or not the result is not ja locale unless Japanese Language Pack is not installed.

I using Firefox with geckodriver as WebDriver remote end, it's very useful for me that `intl.locale.requested` pref will affect to JS locale unless Language Pack is installed.
Component: Untriaged → JavaScript: Internationalization API
Product: Firefox → Core
Thank you for reporting.

This is intentional, JS context locale is tied to Firefox locale, not requested locale.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #1)
> This is intentional, JS context locale is tied to Firefox locale, not
> requested locale.

Thanks for your answer. But I'm wondering about locale more. Can I ask you more questions?

1. What is “Firefox locale”? 
In case that `ja` lacale is requested but Japanese Language Pack is not installed, then Firefox locale will be Firefox's default locale (I think that the locale of downloaded Firefox binary from https://www.mozilla.org/firefox/all/ is Firefox's default locale), isn't it?

2. Is `intl.locale.requested=en-US` special?
In case that Firefox binary for ja locale ( https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=ja ) is installed and `intl.locale.requested=en-US` pref is set (English Language Pack is not installed, Firefox UI is ja locale), the result of `new Date().toLocaleString()` is en-US locale (such as "7/18/2018, 1:27:12 AM"). Is this intentional?
I think Firefox locale is ja in this case, so that the result should be ja locale, shouldn't it?

Thanks.
> 1. What is “Firefox locale”? 

Great question!

Please, read about it in our documentation: https://firefox-source-docs.mozilla.org/intl/locale.html

> 2. Is `intl.locale.requested=en-US` special?

No, but `en-US` is special for us - it's what we call `last fallback locale` - read about it here: https://firefox-source-docs.mozilla.org/intl/locale.html#default-and-last-fallback-locales
I understood about locales.
Thanks so much!
You need to log in before you can comment on or make changes to this bug.