Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Approach to externally stored language preference with iframe #6068

Open
microbit-matt-hillsdon opened this issue Jan 17, 2025 · 2 comments
Open

Comments

@microbit-matt-hillsdon
Copy link
Contributor

Is your feature request related to a problem? Please describe.
micro:bit CreateAI shows an iframe-embedded MakeCode after significant prior user interaction. So we have our own language menu (for a subset of the languages MakeCode supports) for all the UI prior to MakeCode.

We pass our language to MakeCode on the URL. This seems to be the only way to communicate it at the moment. We reload it when the language changes in CreateAI.

MakeCode's own language menu doesn't integrate with this scenario. It reloads MakeCode but the language stays unchanged.

I think what happens is that the URL always wins and MakeCode reloads on language change. So MakeCode updates its language cookie (e.g. from en to fr) then reloads, notices en is on the URL and copies en to the cookie again. We noticed this doesn't happen in local dev - in this case for us MakeCode concludes cookies aren't working and actually updates the URL before reload.

Describe the solution you'd like
Any reasonable approach that allows us to:

  1. set an initial language (in a way that won't result in an extra load)
  2. be able to change the MakeCode language from the embedding app
  3. be notified when the user changes the language inside MakeCode (so we can update our preference and our own UI) and have that language change actually take effect in MakeCode

Describe alternatives you've considered
We considered some other options on microbit-foundation/ml-trainer#580.

A really minimal fix could be a way to suppress the MakeCode language menu option. The embedding app could still offer MakeCode-only languages if desired (we do this in micro:bit classroom).

CC @abchatra - as discussed this week

@abchatra abchatra added this to the Hotfix ongoing milestone Jan 18, 2025
@abchatra
Copy link
Collaborator

@riknoll opinion on this?

@riknoll
Copy link
Member

riknoll commented Jan 30, 2025

i think adding an editor message for this would be pretty niche, but i'm fine with suppressing the language option in the context menu. we could add a pxtarget flag and a query variant that flips it on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants