[wp-meta] [Making WordPress.org] #7769: Live-Preview: load Playground in actual language
Making WordPress.org
noreply at wordpress.org
Mon Sep 16 01:30:53 UTC 2024
#7769: Live-Preview: load Playground in actual language
------------------------------+---------------------
Reporter: threadi | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Plugin Directory | Resolution:
Keywords: |
------------------------------+---------------------
Comment (by tellyworth):
Thanks for the ideas @threadi!
b) Introduction of language-specific blueprints.json at wordpress.org.
The potential for multiple language-specific blueprints is one of the
reasons I put blueprint files in a separate subdir. There's as-yet-unused
code in place to detect and import multiple blueprints, but it doesn't yet
commit to any particular use case.
I'd hesitate to go with this solution though unless there are compelling
benefits. If it turned out there were other useful dimensions for multiple
blueprints (for different plugin versions, or different preview types,
say) then we'd very quickly multiply the number of blueprints by some
number of languages and create an unsustainable mess.
c) wordpress.org could generate a language-specific file from the basic
blueprint.json
The challenge here is that such files must also be stored somewhere and
somehow.
Here's where I have good news!
Plugin `blueprint.json` files aren't served directly, for CORS and
performance reasons. They're stored in postmeta and output by a REST API
endpoint:
https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html
/wp-content/plugins/plugin-directory/api/routes/class-plugin-
blueprint.php#L30
This means we have the opportunity to automatically add a step or property
to the blueprint on-the-fly. It would be easy enough to pass the locale
through to the API so it knows what option to add.
At a quick glance I don't see an obvious blueprint property for setting
the language, even though there is one in the query API. Do you happen to
know if there's a blueprint property for it? (If not I guess we can add a
`siteOptions` step).
It shouldn't be too difficult to work up a quick patch for the REST API
and preview button.
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/7769#comment:1>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list