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

Language switcher #199

Closed
adamziel opened this issue Apr 12, 2023 · 9 comments
Closed

Language switcher #199

adamziel opened this issue Apr 12, 2023 · 9 comments

Comments

@adamziel
Copy link
Collaborator

adamziel commented Apr 12, 2023

Let's add a UI control to switch Playground to another language. Here's how @akirk does it in his GlotPress integration project:

https://github.com/akirk/wp-glotpress-playground/

@akirk
Copy link
Member

akirk commented Apr 12, 2023

The meat is here: https://github.com/akirk/wp-glotpress-playground/blob/ab5942aceed309c3f87db2b8fe26d781d199aeb4/index.php#L76-L85

There are some things that you don't need for a "normal" install:

  • PO files. WordPress displays MO files.

And some things that you still need:

  • JSON translation files for Gutenberg.

@adamziel
Copy link
Collaborator Author

Oki so languages are supported via Blueprints. Playground just needs a documentation page and maybe a handy language picker in the settings modal that would apply the Blueprint for the user.

For example, a Blueprint to run WordPress with Japanese translations:

{
   "landingPage":"/wp-admin/?welcome=0",
   "steps":[
      {
         "step":"login",
         "username":"admin",
         "password":"password"
      },
      {
         "step":"mkdir",
         "path":"/wordpress/wp-content/languages/plugins"
      },
      {
         "step":"mkdir",
         "path":"/wordpress/wp-content/languages/themes"
      },
      {
         "step":"writeFile",
         "path":"/wordpress/wp-content/languages/ja_JA.mo",
         "data":{
            "resource":"url",
            "caption":"Downloading ja_JA.mo",
            "url":"https://translate.wordpress.org/projects/wp/dev/ja/default/export-translations?format=mo"
         }
      },
      {
         "step":"writeFile",
         "path":"/wordpress/wp-content/languages/admin-ja_JA.mo",
         "data":{
            "resource":"url",
            "caption":"Downloading admin-ja_JA.mo",
            "url":"https://translate.wordpress.org/projects/wp/dev/admin/ja/default/export-translations?format=mo"
         }
      },
      {
         "step":"setSiteOptions",
         "options":{
            "WPLANG":"ja_JA"
         }
      }
   ]
}

To use it, put the above behind a hash # as follows:

https://playground.wordpress.net/#{%22landingPage%22:%22/wp-admin/?welcome=0%22,%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22},{%22step%22:%22mkdir%22,%22path%22:%22/wordpress/wp-content/languages/plugins%22},{%22step%22:%22mkdir%22,%22path%22:%22/wordpress/wp-content/languages/themes%22},{%22step%22:%22writeFile%22,%22path%22:%22/wordpress/wp-content/languages/ja_JA.mo%22,%22data%22:{%22resource%22:%22url%22,%22caption%22:%22Downloading%20ja_JA.mo%22,%22url%22:%22https://translate.wordpress.org/projects/wp/dev/ja/default/export-translations?format=mo%22}},{%22step%22:%22writeFile%22,%22path%22:%22/wordpress/wp-content/languages/admin-ja_JA.mo%22,%22data%22:{%22resource%22:%22url%22,%22caption%22:%22Downloading%20admin-ja_JA.mo%22,%22url%22:%22https://translate.wordpress.org/projects/wp/dev/admin/ja/default/export-translations?format=mo%22}},{%22step%22:%22setSiteOptions%22,%22options%22:{%22WPLANG%22:%22ja_JA%22}}]}

@Marc-pi
Copy link

Marc-pi commented Oct 24, 2023

yep, that's a need to be able to run the Playground in other languages than English.
the doc https://wordpress.github.io/wordpress-playground/faq/#is-wordpress-playground-available-in-another-language

Solutions :

@adamziel
Copy link
Collaborator Author

A UI config/switcher would be nice indeed! CCing @akirk on that

@adamziel adamziel changed the title Support multiple languages UI language switcher to easily support other languages Oct 29, 2023
@adamziel adamziel changed the title UI language switcher to easily support other languages Language switcher Nov 22, 2023
@adamziel adamziel mentioned this issue Nov 25, 2023
@adamziel adamziel modified the milestone: User Experience Feb 29, 2024
@adamziel adamziel moved this to Future work in Playground Board Jun 30, 2024
@adamziel
Copy link
Collaborator Author

cc @jarekmorawski – would this be easy to incorporate in the WebApp redesign? If yes, would you be up for adding a widget somewhere? If it turns out to be tricky for any reason, let's save it for the future.

@jarekmorawski
Copy link

To be clear, do you need a language switcher for sites created and managed in Playground or the new Playground UI?Both, maybe?

@bgrgicak bgrgicak moved this from Inbox to Future work in Playground Board Jul 24, 2024
@adamziel
Copy link
Collaborator Author

Just whenever you create a new site within Playground, right next to the PHP version picker. I've seen that in Figma so I think we're good here design-wise and only need to incorporate this in the new implementation. Thank you!

@bgrgicak
Copy link
Collaborator

bgrgicak commented Aug 1, 2024

I linked the issue to the project.

@adamziel adamziel moved this from Up next to In progress in Playground Board Sep 25, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Playground Board Sep 27, 2024
@adamziel
Copy link
Collaborator Author

Solved by #1731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status: No status
Development

No branches or pull requests

5 participants