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

api.w.org needs locale for pattern translation #32754

Closed
iandunn opened this issue Jun 17, 2021 · 3 comments · Fixed by #33052
Closed

api.w.org needs locale for pattern translation #32754

iandunn opened this issue Jun 17, 2021 · 3 comments · Fixed by #33052
Assignees
Labels
REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@iandunn
Copy link
Member

iandunn commented Jun 17, 2021

What problem does this address?

#28800 moved Core's block patterns out of Gutenberg and into the w.org Pattern Directory, which means they're no longer translated by Gutenberg. api.w.org will handle translation, but needs to know the user's locale.

Knowing the WP version might also help with caching, and let the API avoid sending newer patterns to old WP versions which don't have the dependent blocks, etc.

What is your proposed solution?

The locale and version can be added to the API request, similar to how the Events Widget

https://github.com/WordPress/wordpress-develop/blob/81182b52ef9a59dc157191d77e130fe166fb2adf/src/wp-admin/includes/class-wp-community-events.php#L198

https://github.com/WordPress/wordpress-develop/blob/81182b52ef9a59dc157191d77e130fe166fb2adf/src/wp-admin/includes/class-wp-community-events.php#L102

I'm planning to open a PR tonight or tomorrow.

@talldan talldan added [Type] Enhancement A suggestion for improvement. REST API Interaction Related to REST API labels Jun 17, 2021
@jeffpaul
Copy link
Member

@iandunn
Copy link
Member Author

iandunn commented Jun 22, 2021

Core commits:

https://core.trac.wordpress.org/changeset/51206
https://core.trac.wordpress.org/changeset/51208

@youknowriad
Copy link
Contributor

Can we apply the same changes in the Gutenberg repository as well (for old WP versions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants