p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

FES message is broken if reserved words are used.

Open shibomb opened this issue 6 months ago • 7 comments

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;
}

shibomb avatar Aug 03 '24 17:08 shibomb