-
Notifications
You must be signed in to change notification settings - Fork 29
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
REST API: Add locale suggestion endpoint & helpers for plugins and themes #609
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mu-plugins/rest-api/endpoints/class-wporg-plugins-locale-banner-controller.php
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-plugins-locale-banner-controller.php
Outdated
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-themes-locale-banner-controller.php
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-themes-locale-banner-controller.php
Show resolved
Hide resolved
I've taken a look at the code and left some minor suggestions. I don't know how much is moved code versus new so I'll let you determine what needs to be updated in regards to that. Otherwise, I feel comfortable merging this. |
dd32
approved these changes
May 14, 2024
mu-plugins/rest-api/endpoints/class-wporg-base-locale-banner-controller.php
Outdated
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-plugins-locale-banner-controller.php
Outdated
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-plugins-locale-banner-controller.php
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-base-locale-banner-controller.php
Outdated
Show resolved
Hide resolved
mu-plugins/rest-api/endpoints/class-wporg-base-locale-banner-controller.php
Outdated
Show resolved
Hide resolved
I've made the requested updates and I think it's good to merge now, but I'll wait until tomorrow in case there's any more feedback or comment replies. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See WordPress/wporg-theme-directory#52 — I've moved
rest-api-locale.php
tomu-plugins/helpers/locale.php
, and the endpoint torest-api/endpoints/
. In fact, I've updated the code to handle both theme and plugin requests, so that all this locale-banner-related code can stay in one place (this isn't exactly what was requested on the other PR, but once I started building it out as two similar endpoints, it made sense to share a base class & live here).The endpoints:
These can also be used from Rosetta URLs
The routes should only appear on the relevant sites, so you can't request
wordpress.org/themes/wp-json/wporg-plugins/v1/locale-banner/
.This leaves open the possibility to add a
patterns
variation later, if we wanted to.To test
Same instructions as WordPress/wporg-theme-directory#52
You can also try with the
try/mu-plugins-locale-api
branch on wporg-theme-directory, which should show the banner if your browser is set up to send alternate language suggestions.There is also a
debug
parameter you can add to the endpoints to show more information about the request. For example,