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

Changing language inside MakeCode in CreateAI doesn't work #580

Open
microbit-matt-hillsdon opened this issue Jan 9, 2025 · 0 comments
Open

Comments

@microbit-matt-hillsdon
Copy link

microbit-matt-hillsdon commented Jan 9, 2025

In local dev it seems to work. But what happens in the deployed version is that MakeCode writes the updated language to the cookie, just reloads the page without changing the lang= parameter on the URL. But at init time MakeCode prioritises lang=whatever over the cookie and we use that to propagate CreateAI's language preference to MakeCode. So it copies that unchanged lang=en value to the cookie. If you watch the cookie you see it change e.g. en -> fr -> en again after the reload.

A non-exhaustive set of options we've considered:

  1. No language menu in MakeCode (e.g. via an option)
  2. A reimplemented header that can have CreateAI's language menu (like micro:bit classroom)
  3. Some way to make MakeCode take the code path that updates the URL if the language was specified by URL in the first place. Requires MakeCode change. At the moment it only does this if it thinks cookies aren’t working (can’t read back language cookie).
  4. A way to make MakeCode prioritise cookie language over URL
  5. Add/change MakeCode iframe messages to set initial language, change it and broadcast changes in MakeCode

In the short term we're likely to ship languages without a working language menu in MakeCode as you'd likely need to change language earlier than MakeCode anyway.

(5) seems like the nicest approach but will need a non-trivial MakeCode change. But there's also the complication of MakeCode supporting more languages than CreateAI, and (2) or (5) + API to limit language choice in MakeCode are the only ways to address that (or 1, I guess).

One for discussion.

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

No branches or pull requests

1 participant