Repository navigation
Conversation
…quote blocks The editor UI only translated core/paragraph and core/heading, even though the plugin already has shared infrastructure (used by the Editorial Updates experiment) for reading and writing a block's primary RichText attribute regardless of block type. - Add core/list-item, core/verse, core/preformatted, and core/pullquote to TRANSLATION_SUPPORTED_BLOCK_TYPES. - Fix the write-back path, which hard-coded the `content` attribute and would have silently failed to apply translations to core/pullquote (whose text lives in `value`). It now resolves the correct attribute per block via the shared getEditableTextAttribute() helper, the same one Editorial Updates already uses. - Update the experiment docs and add an e2e test covering the new block types and the value-attribute write-back. core/table, core/image, and secondary fields like a pullquote's or quote's citation are left out: their text isn't a single RichText attribute this experiment's write-back path can target. Closes WordPress#979 AI assistance: Yes. Tool(s): Claude Code (Sonnet 5). Used for: tracing the existing block-support and write-back code, identifying the value-attribute bug, implementing the fix, and updating docs/tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @ugyendorji@Ugyens-MacBook-Air.local. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1009 +/- ##
==========================================
Coverage 81.50% 81.50%
Complexity 2923 2923
==========================================
Files 122 122
Lines 11653 11653
==========================================
Hits 9498 9498
Misses 2155 2155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Test reportTested commit Verdict: looks correct, recommend approve. Static checks are clean and the code change matches the stated fix. Live, end-to-end translation in a running editor could not be exercised in this environment (details below). Verified
Not run
Minor finding (non-blocking)
🤖 Tested and reported by Claude Code |
The Settings > AI > Editor Experiments card description still said "paragraph and heading blocks" after this PR added list item, verse, preformatted, and pullquote support. docs/experiments/content-translation.md was updated to reflect the new block types; this admin-facing string was missed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Fixed the stale description string flagged above in eac36cc — the Settings → AI card now lists all six supported block types. |
Gutenberg renamed the core/verse block's display title to "Poetry" while keeping the block name core/verse for backward compatibility, so the block wrapper's accessible name is "Block: Poetry", not "Block: Verse". Update the e2e assertion to match, fixing a false failure in the new list item/verse/preformatted/pullquote coverage. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Ran the new e2e coverage ( Found one real bug, isolated to the test itself (not the PR's translation code): the "Translates list item, verse, preformatted, and pullquote blocks" test asserted on Fixed in eac36cc..8b9d22a by updating the locator to Result: 10/10 e2e tests passing on the current branch tip ( Verdict: looks correct, recommend approve. |
The PHP 7.4/8.0 test jobs failed on a transient Debian security mirror 404 during Docker image build (apt-get install sudo / dpkg-dev), unrelated to this PR's diff -- the same jobs passed cleanly on develop 3 days ago. Empty commit to retrigger CI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PHP 8.0 (WP 7.0/latest/trunk) still 404ing on deb.debian.org/debian-security fetching sudo_1.9.5p2-3+deb11u4_amd64.deb during Docker image build -- a live Debian mirror/CDN inconsistency outside this repo (the Dockerfile is generated by @wordpress/env, not checked in here; confirmed the latest published @wordpress/env 11.14.0 doesn't yet rewrite bullseye-security to archive.debian.org the way it already does for buster/stretch). Retrying once more since it's a live network condition that can clear between runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Test PHP 8.0 (and intermittently 7.4) jobs have been failing across every open PR, not just this one: the wp-env Docker build 404s fetching packages (sudo, libc-dev-bin, ...) from deb.debian.org/debian-security's bullseye-security suite, which is serving a stale/inconsistent index on some mirror nodes even though bullseye isn't officially archived yet. @wordpress/env's generated Dockerfile already routes stretch and buster through archive.debian.org for exactly this kind of EOL/mirror inconsistency, but doesn't yet do the same for bullseye (confirmed against the latest published 11.14.0, which also lacks it). Patch it in via patch-package -- applied automatically through postinstall -- until upstream ships a real fix. Verified: reinstalled a pristine @wordpress/env and confirmed `npm run postinstall` (what `npm ci` runs) reapplies the patch cleanly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ocker build" This reverts commit 1a3d5b5.
|
Thanks for the PR @dugyen. Increasing the blocks we support is great but wondering if there's a better way to ensure we support all Core blocks, rather than only supporting a subset? I understand not all blocks have text to translate so we may need to maintain some sort of list but it would be ideal if any text within any Core block can be translated. I just fear we'll have to continue to open new PRs to increase our block support here and would be ideal if we can just support everything (more or less). I know our Editorial Notes feature does already support most blocks (including tables) so that's an area I'd suggest looking at for ideas. |
What?
Closes #979
Expands the Content Translation experiment's editor UI to support translating
core/list-item,core/verse,core/preformatted, andcore/pullquoteblocks, in addition to the existingcore/paragraphandcore/heading.Why?
The Content Translation experiment (#747) only translates paragraph and heading blocks, even though the plugin already ships shared infrastructure for reading and writing a block's primary text attribute regardless of block type — the Editorial Updates experiment already uses it for a wider set of blocks (
getEditableTextAttribute()insrc/utils/blocks.ts). This PR takes advantage of that existing infrastructure for Content Translation, as suggested in #979.How?
src/experiments/content-translation/constants.ts: addedcore/list-item,core/verse,core/preformatted, andcore/pullquotetoTRANSLATION_SUPPORTED_BLOCK_TYPES.src/experiments/content-translation/utils/index.ts:getTranslatableBlock()now also resolves and returns the block's editable attribute via the sharedgetEditableTextAttribute()helper.src/experiments/content-translation/hooks/useContentTranslation.ts: the write-back path previously hard-coded thecontentattribute when applying a translation. That's a latent bug for any block whose text lives elsewhere —core/pullquoteusesvalue— so adding it to the supported list without this fix would have translated the block but silently failed to apply the result. The write-back now uses the attribute resolved above.docs/experiments/content-translation.mdto reflect the new supported blocks and explain the RichText-attribute constraint.tests/e2e/specs/experiments/content-translation.spec.js) covering all four new block types, including that the pullquote'svalueattribute (notcontent) gets updated.Deliberately out of scope, with reasoning left as a code comment in
constants.ts:core/tableandcore/image: their text isn't a single RichText attribute, so they need dedicated read/write handling this experiment doesn't have.core/quote's andcore/pullquote'scitationfield, andcore/details'ssummary: secondary text the current one-attribute-per-block write-back path doesn't target.core/code: source code, not prose to translate.core/quote,core/list) need no direct entry: their own text lives in child blocks (core/paragraph,core/list-item), which are already reached because the block tree is flattened before filtering.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Surveying open issues to find an unclaimed, well-scoped one; tracing the existing block-support and write-back code across the Content Translation and Editorial Updates experiments to find the shared
getEditableTextAttribute()infrastructure; identifying the value-attribute write-back bug; implementing the fix, docs, and e2e test. I reviewed the diff, rannpm run typecheckandwp-scripts lint-jslocally (both clean), and take responsibility for the change.Testing Instructions
core/list-item(inside acore/list), acore/verse, acore/preformatted, and acore/pullquoteblock, each with enough content to pass the minimum length.npm run typecheckandnpx wp-scripts lint-json the changed files.Changelog Entry