Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for navigator.languages #12419
Thank you for this patch!
This is a good start but it doesn't really address the bug report, which uses the sample case of
["en-US", "zh-CN", "ja-JP"] being returned.
Instead, this just takes at most one and unconditionally appends English to it.
I am not a locale expert but is this really the desired behavior?
The test failed on Windows, I'm not sure of the cause:
not ok 778 chromium feature navigator.languages should not repeat en for non US english locales like en-GB AssertionError [ERR_ASSERTION]: '' == '[ \'en-GB\', \'en-US\', \'en\' ]' at Socket.appProcess.stdout.on (C:\projects\electron\spec\chromium-spec.js:153:16) at Socket.emit (events.js:127:13) at addChunk (_stream_readable.js:269:12) at readableAddChunk (_stream_readable.js:256:11) at Socket.Readable.push (_stream_readable.js:213:10) at Pipe.onread (net.js:598:20)
I think returning system locale for
navigator.langauges is a good start. Appending
en-US is good enough to make web pages happy, but it seems that the original issues is about making
navigator.langauges return the preferred languages of the user, in that case appending
en-US would be wrong.
I also did a test, on Safari
navigator.langauges only returns current system language, while Chrome returns all supported languages in my preferences.
So we could probably only return current system locale in this PR, while keep the original issue open before we fully fixed it.
I do not mind repurposing this PR to get the full desired implementation working, instead of having only the locale as that might not be very helpful.
Chrome has it's own language settings which it uses for the displaying the list in