Skip to content

Translate block names in patterns - #86

Merged
juanfra merged 1 commit into
trunkfrom
i18n/translate-block-names
Sep 22, 2026
Merged

juanfra merged 1 commit into
trunkfrom
i18n/translate-block-names

Conversation

@MaggieCabrera

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>
Co-authored-by: juanfra <juanfra@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added [Area] Patterns Issues or PRs that touch the theme's block patterns. First-time Contributor Pull request opened by a first-time contributor to the repository labels Sep 21, 2026
@github-actions

Copy link
Copy Markdown

👋 Thanks for your first pull request, @MaggieCabrera! We'll take a look soon.

@juanfra juanfra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks Maggie 🚢

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
juanfra force-pushed the i18n/translate-block-names branch from b45b402 to b6a2461 Compare September 22, 2026 08:50
@juanfra
juanfra merged commit a4c5ce9 into trunk Sep 22, 2026
4 checks passed
@juanfra
juanfra deleted the i18n/translate-block-names branch September 22, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Patterns Issues or PRs that touch the theme's block patterns. First-time Contributor Pull request opened by a first-time contributor to the repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate block names in patterns

2 participants