wordplaydev / wordplay

An accessible, language-inclusive programming language and IDE for creating interactive typography on the web.
Other
57 stars 22 forks source link

Sequence style parameter lists values in multiple translations #541

Open azmec opened 1 month ago

azmec commented 1 month ago

What happened?

When Wordplay lists the possible values of a function or constructor parameter, it should list only one translation of those values. However, switching between localizations appends the translation for the selected locale to the list of possible values for Sequence's style parameter.

  1. Open a blank Wordplay project.
  2. Write foo: Sequence(spin() 5s style: ""). Do not list a style.
  3. Observe that the program stage and conflict resolutions list only "straight", "cautious", "pokey", and "zippy" as possible options for the style parameter.
  4. Switch to Spanish-Mexico locale.
  5. Observe that the program stage and conflict resolutions now list the English and Spanish translations for the style parameter.
  6. Switch to the Chinese locale.
  7. Observe that the program stage and conflict resolutions now list the English, Spanish, and Chinese translations for the style parameter.

Anything else?

Below is an image of the defect.

image

What browsers are you seeing the problem on?

Chrome

What operating system are you using?

Linux

amyjko commented 1 month ago

The underlying cause of this is that we remember all previously used locales and use that to generate a localized definition of all APIs. This project previously used Spanish and Chinese, and so these locales are included. This usually isn't noticeable, but it shows up here because text types aren't language filtered in error messages. It also shows up in the translation dialog, where the history of languages is shown.

Two possible remedies: