processing / processing/p5.js-web-editor

Incorrect value of navigator.language property in the editor and fullscreen mode

Open
#1,772 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Good Medium Issue Priority:Low
Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

Nature of issue?
  • Found a bug
Details about the bug:

I'm using the Chrome browser on a Chromebook Version 88.0.4324.186 (Official Build) (64-bit)

I wanted to test an api call that passed my browser's language and test it with other languages. I'm getting the language code from the navigator.language property. The default value of navigator.language is "en-GB". I installed a Chrome Locale Switcher extension to change this value. Whenever I switch locales I reload the sketch. When I tested my code I noticed that whatever language I changed the locale to, for example "fr", "en-GB" was always being passed to the api. I console logged the value in the p5 console and it showed "en-GB". However, if I open the Chrome dev tools and display the value of navigator.language it is shown as "fr". When I run the sketch in "present" mode, via the share option, the value of navigator.language is correctly returned as "fr". The incorrect value is also returned in "full" mode.

A simple snippet of code would be
console.log(navigator.language);

Contributor guide

Open the contributing guide

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

Reproduce the issue in the editor using console.log(navigator.language) with Chrome's locale changed, then compare the value in the editor, full mode, and present mode. Trace the editor and fullscreen entry points involved in running sketches; done means the reported locale matches the browser locale in editor and full mode as it already does in present mode.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.