New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 826153 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 795680
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

navigator.language not working as before in version 65

Reported by b.sundee...@gmail.com, Mar 27 2018

Issue description

Chrome Version       : 65.0.3325.181
OS Version: 10.0
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL after other browsers where you have tested this issue:
     Safari:
    Firefox:
    IE/Edge:

What steps will reproduce the problem?
1. Go to settings.
2. Click on Advanced in the side bar.
3. Click on Languages.
4. Assume that your current language is en-us and also first in the list.
5. Add a language for example french.
6. Right click on the language, and check "Display google chrome in this language option".
7. Relaunch the browser.
8. Now, open any tab in browser.
9. Click on f12, and in console tab, try to get the value for navigator.language.
10. It still shows en instead of fr.

We use this setting and navigator.language value to determine browser language.
Previously in version 64, 
navigator.language used to give the the language which has the setting "Display google chrome in this language" checked on.



What is the expected result?

It must return navigator.language value as the language that has "Display google chrome in this language" checked on.


What happens instead of that?

Currently, in version 65, navigator.language gives the language which is first in the list of languages present in settings page. 


Please provide any additional information below. Attach a screenshot if
possible.

UserAgentString: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36



 
chromeissue.PNG
54.6 KB View Download

Comment 1 by woxxom@gmail.com, Mar 27 2018

Bisect info: 521385 (good) - 521395 (bad)
https://chromium.googlesource.com/chromium/src/+log/557e241c..abb3c8f7?pretty=fuller
Suspecting r521394 = a029f27a6e98a43e8f1492b85ca18007670d9b28 = https://crrev.com/c/581295 by juri.valdmann@qt.io
"Ensure navigator.language agrees with navigator.languages"
Landed in 65.0.3285.0

The new behavior is intended:

    Although perhaps not strictly required by the specification, it is at least
    quite clearly suggested that navigator.language should equal the first element
    of navigator.languages.

You can reorder the list of languages manually in the settings UI using the three-dot menu on a language entry.
Components: UI>Browser>Language>Translate
Labels: Needs-Triage-M65
Cc: sindhu.chelamcherla@chromium.org juri.val...@qt.io
Labels: -Type-Bug -Pri-3 ReleaseBlock-Stable RegressedIn-65 M-65 Target-65 Target-67 Target-66 FoundIn-66 FoundIn-65 FoundIn-67 OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: bokan@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce this issue reported version 65.0.3325.181, on latest beta 66.0.3359.45 and on latest canary 67.0.3382.0 using Windows 10, Mac 10.13.3 and Ubuntu 14.04.

Good Build:65.0.3284.0
Bad Build:65.0.3285.0

Suspecting https://chromium-review.googlesource.com/581295 from above changelog.

@juri.valdmann: Please confirm whether this is a bug or intended behavior. Adding RB-Stable for M-65. Please change if not the case.

Unable to assign to as he is not a project member. Hence assigning to reviewer bokan@.

Thanks!

Comment 4 by bokan@chromium.org, Mar 28 2018

Labels: -ReleaseBlock-Stable
Mergedinto: 795680
Status: Duplicate (was: Assigned)
#1 is correct, this is intentional.
Thank you for the detailed inputs.
Going by the comments, if that's the intended behavior, is their any other way to retrieve the language that has "Display google chrome in this language" turned on ?

navigator.language is giving first item in the list.

navigator.languages gives all the list of languages.

What's the way to get the language that has this setting turned on ?

Please suggest.
it would be really helpful, thanks in advance.
Is there any update on this? I want to get the selected language of browser but navigator.language is always returning item which is on 0 index of navigator.languages array.

Thanks. 
Re#6: This is now intended behavior. See https://bugs.chromium.org/p/chromium/issues/detail?id=795680#c6 for explanation.

Sign in to add a comment