Skip to content

Language Selection via URL Query Parameter #3490

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

Open
raclim opened this issue May 19, 2025 · 7 comments · May be fixed by #3492
Open

Language Selection via URL Query Parameter #3490

raclim opened this issue May 19, 2025 · 7 comments · May be fixed by #3492
Assignees
Labels
Feature Request Proposal for adding a new functionality Good Medium Issue A moderately complex issue for contributors with some experience

Comments

@raclim
Copy link
Collaborator

raclim commented May 19, 2025

Increasing Access

Currently, users can set the language of the p5.js editor by using the language dropdown on the upper-left hand navigation menu (pictured below). While language preferences are saved to a user's account, they have to be set manually by the user.

Image

Adding support for a URL query parameter to set the language would make it easier to share the p5.js editor in different languages. This was initially raised by @SableRaf!

Feature request details

What Would This Look Like?
The query parameter to determine the language would be set at the end of a url, such as https://editor.p5js.org/path?lang=fr. This would load the editor in French.

What Are Some Considerations?

  • Should visiting a URL with a language parameter also update the user's saved language preference, or only apply for that session?
  • What happens if the lang value is invalid or unsupported?

Please feel free to continue fleshing out what this might look like and further considerations that would need to be made here in the comments below!

@raclim raclim added Feature Request Proposal for adding a new functionality Needs Discussion Requires further conversation or consensus Good Medium Issue A moderately complex issue for contributors with some experience and removed Needs Discussion Requires further conversation or consensus labels May 19, 2025
@deveshidwivedi
Copy link

Hi @raclim

  • Could we apply the language setting just for that session, rather than changing the user’s saved preference? That way, we avoid accidentally switching someone’s default language when they’re just visiting a shared link in a different language.

  • If the lang value in the URL is invalid or not supported, we could fall back to the default language which might be English or whatever the user’s browser is set to. Maybe we could also show a small alert?

@SableRaf
Copy link
Contributor

I agree that we shouldn't change the user's default preference.

In fact, if they are logged in, would it not make sense to ignore the lang value entirely? They likely already have their preferred language selected.

As I imagined the feature, the lang URI parameter would be useful for sharing the editor with first time users in their own language.

@deveshidwivedi
Copy link

In fact, if they are logged in, would it not make sense to ignore the lang value entirely? They likely already have their preferred language selected.

As I imagined the feature, the lang URI parameter would be useful for sharing the editor with first time users in their own language.

Thank you for the clarification, that makes a lot of sense! Would it be okay if I open a draft PR to share my idea and get feedback?

@raclim
Copy link
Collaborator Author

raclim commented May 20, 2025

Yes @deveshidwivedi, feel free to give this a go! I'll assign the issue to you :)

@SableRaf
Copy link
Contributor

@raclim @deveshidwivedi: Just a quick thought; if we’re not already doing this, using the browser’s Accept-Language header (or navigator.language) might be a simpler and more standard way to set the interface language for first-time users.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language

@raclim
Copy link
Collaborator Author

raclim commented May 20, 2025

That's a great thought! We have a few util files in client/utils that use the Navigator object to detect platform and userAgent. We don't have one for language, so that definitely could be something to explore as well!

@SableRaf
Copy link
Contributor

SableRaf commented May 20, 2025

Thanks @raclim! In that case, I think detecting the browser language would address the use case I had in mind more directly. Unless there’s a specific reason to prefer the URI parameter, I’d suggest going with that approach instead.

This seems like a perfect low-hanging fruit for improving the accessibility of the editor to non-English speaking first time users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Proposal for adding a new functionality Good Medium Issue A moderately complex issue for contributors with some experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants