max-mapper / max-mapper/browser-locale

Chrome browser language not necessarily first in languages list

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
104
Forks
7
PR merge metrics
No merged PRs in 30d

Description

It seems that in the latest version of Chrome (v. 59.0.3071.115), the display language is not necessarily the first one in the window.navigator.languages list (so taking languages[0] gets a wrong result).

See screenshots below:

Chrome navigator
chrome_navigator

Chrome settings
chrome_settings

Maybe it would be an idea to take into account the window.navigator.language value first and, if not found, use the first entry in the window.navigator.languages array.

P.S.: As far as I could see, now even the latest versions of IE and Edge set the window.navigator.language value.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the JavaScript locale-detection entry point and how it currently reads window.navigator.languages. Verify the reported Chrome behavior, then use window.navigator.language as the preferred value with the languages list as fallback. Done means the selected locale matches the browser display language while preserving fallback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.