Open adamziel opened 1 year ago
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:
And some things that you still need:
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:
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 :
add a config within the Playground Customize
add a switcher like the default WP (see settings)
improve /fix the doc see https://github.com/WordPress/wordpress-playground/issues/723
A UI config/switcher would be nice indeed! CCing @akirk on that
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.
To be clear, do you need a language switcher for sites created and managed in Playground or the new Playground UI?Both, maybe?
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!
I linked the issue to the project.
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/