microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
710 stars 589 forks source link

The beta version of makecode experienced a stuck situation when switching to the language "catalan" extension and adding it #5186

Closed elecfreaks1 closed 1 year ago

elecfreaks1 commented 1 year ago

Describe the bug A problem was found in the beta version of makecode micro: bit. The translation was switched to "catalan", and an extension was added and the interface was stuck

To Reproduce Steps to reproduce behavior:

  1. Go to https://makecode.microbit.org/beta#
  2. Click on the language switch function and select 'catalan'
  3. Create a blank project and add an extension 'cutebot'
  4. See error Tips1: If you switch the language to "English" and add the extension "cutebot", there will be no error situation Tips2: Expand the Github link for 'cutebot': https://github.com/elecfreaks/pxt-cutebot/tree/master/_locales/ca

Expected behavior If you switch the language to 'catalan' and add the extension 'cutebot', there will be no error situation

Screenshots image image

micro:bit version (please complete the following information): micro:bit V2

jwunderl commented 1 year ago

This is a bug with the extension; if you open up the second link you'll see some red characters indicating that they're incorrectly encoded as they're not escaped correctly e.g. you can also see this if you try and fetch / display them by running this:

fetch("https://github.com/elecfreaks/pxt-cutebot/raw/master/_locales/ca/cutebot-strings.json")
    .then(resp => console.log(resp.json()));

if you compare it against the other files you'll see there is a missing second slash to escape the first one like there is in all the other localization files. That needs to be fixed for the file to be able to be loaded into the editor / the translations won't work right now.

That said, this also shouldn't be an error that causes a hang, probably just need to change a JSON.parse to a pxt.Util.jsonTryParse