processing / processing/p5.js

FES message is broken if reserved words are used.

Open
#7,168 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

p5.js version

1.9.4, 1.10.0

What is your operating system?

None

Web browser and version

Any browser (set non-English (e.g. Spanish, Japanese) to the top in language priority settings)

Actual Behavior

Set the browser's language preference setting to Japanese,
When executing code using reserved words, an error appears in the console, as if the FES message could not be generated.

スクリーンショット 2024-08-04 2 00 18

Console output:

TypeError: Cannot read properties of undefined (reading 'replaceAll')
p5.js translator called before translations were loaded
Additional information 1:

The problem does not occur if the browser's language preference is set to English language.

Console output:

🌸 p5.js says: you have used a p5.js reserved function "value" make sure you change the function name to something else.
+ More info: https://p5js.org/reference/#/p5/value 
Additional information 2:

Similar source code displays fine in OpenProcessing and local PC.

Console output:

🌸 p5.jsが言っています: p5.jsの予約済み関数 "value" を使用しました。関数名を他の名前に変更してください。
+ 詳細情報: https://p5js.org/reference/#/p5/value
Expected Behavior

Correct FES message as shown below (e.g. Japanese)

🌸 p5.jsが言っています: p5.jsの予約済み関数 "value" を使用しました。関数名を他の名前に変更してください。
+ 詳細情報: https://p5js.org/reference/#/p5/value

If output of the translated version is not possible, a normal message in English should be displayed.

🌸 p5.js says: you have used a p5.js reserved function "value" make sure you change the function name to something else.
+ More info: https://p5js.org/reference/#/p5/value 
Steps to reproduce
Steps:
  1. Set the browser's language preference setting to non-English (e.g. Spanish, Japanese)
  2. add let value = 0 in setup function.
  3. Play
Snippet:
function setup() {
  createCanvas(400, 400);
  let value = 0;
}

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 with the provided setup snippet, a non-English browser language, and the browser console; then trace the FES translation path used for reserved-word warnings. Done means the localized reserved-function message appears correctly, or an English fallback is shown without the replaceAll or translation-loading errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.