WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.63k stars 248 forks source link

(Meetup use case) Display WP Playground interface in browser language #1513

Closed IoanaAMuresan closed 2 months ago

IoanaAMuresan commented 3 months ago

Submitting this after briefly discussing this live with @adamziel at WCEU.

Title pretty much says it all - ensure that WP playground interface / commands are displayed in the default language of the user's browser, rather than in English.

Unsure what other deets you might need; please feel free to reach out if you need me to clarify this further.

adamziel commented 3 months ago

cc @bgrgicak – this would unlock using Playground with non-English audiences. It would be nice to have a parameter like "?localize=1" to detect the language headers and download the right language pack by default. We'll need to download through the plugins-proxy.php because of a pending CORS issue with that endpoint.

bgrgicak commented 3 months ago

If I understand correctly, this isn't about the Playground website UI, it's about the WordPress UI.

Translating the Playground UI would require much more work because we would first need to make all strings translatable using @wordpress/i18n and then find a way to add it to translate.wordpress.org for generating translations.

It would be nice to have a parameter like "?localize=1" to detect the language headers and download the right language pack by default.

We could add a localized parameter to change the WordPress language to a chosen language, but I wouldn't do it automatically without user interaction.

Doing it automatically could also break demos that were made for a specific audience (e.g. a demo for a plugin that is used only in the German market).

I can start by adding a localize query string that changes the WordPress UI language while we discuss the remaining parts.

bgrgicak commented 3 months ago

Here is a PR that adds a language query string and a setSiteLanguage Blueprint step.

bgrgicak commented 2 months ago

@IoanaAMuresan we added support for setting the site language using blueprints and query strings (?language=jp). Would this work for your usecase?

I will mark this issue as done, but please let us know if you need anything else.