Translate block names in patterns - #86
Merged
Merged
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first pull request, @MaggieCabrera! We'll take a look soon. |
The block name in metadata is what the List View shows, so editors see it. Wrap every one in esc_html_x() with a translator context, as Twenty Twenty-Four does, and rename the slug-style names footer, sidebar and search-bar to readable ones. The validator now reports an untranslated block name. patterns/archive.php is left to #58, which translates its names and replaces its query with the Archive Compact pattern. Fixes #85 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
juanfra
force-pushed
the
i18n/translate-block-names
branch
from
September 22, 2026 08:50
b45b402 to
b6a2461
Compare
This file contains hidden or 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
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.
Fixes #85
The block name in `metadata` is what the Site Editor shows in the List View and the block toolbar, so editors see it in their own language everywhere except here. Every block name in the patterns now goes through `esc_html_x()` with a translator context, the same form Twenty Twenty-Four uses and that #58 uses for `archive.php`. The slug-style names `footer`, `sidebar` and `search-bar` become `Footer`, `Sidebar` and `Search Bar` on the way.
`bin/validate-theme.mjs` now reports an untranslated block name, so the check runs in CI and in the pre-commit hook. Punctuation-only names such as `·` are not reported.
`patterns/archive.php` is not touched here. #58 translates its two names and replaces its query with the Archive Compact pattern; until it merges, the validator reports that file.
Testing
`npm run lint:theme` reports only `patterns/archive.php`. The front end renders the same markup as trunk for every pattern; the only differences are the three renamed block names in the List View.
🤖 Generated with Claude Code