Repository navigation
Fixed script translation support for the builder - #529
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new test teardown can fail, and the Beaver translation path remains untested.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Links builder scripts to the plugin translation catalog, addressing issue #527.
Changes:
- Registers translations for Gutenberg, Elementor, and Beaver Builder scripts.
- Adds PHPUnit coverage for Gutenberg and Elementor.
- Extends the Beaver Builder PHPStan stub.
| File | Description |
|---|---|
includes/Editor.php |
Registers Gutenberg script translations. |
includes/Elementor.php |
Registers Elementor script translations. |
includes/TI_Beaver.php |
Registers Beaver translations during its enqueue lifecycle. |
tests/script-translations-test.php |
Adds translation-registration tests. |
tests/php/static-analysis/beaver.php |
Models Beaver’s script registry for PHPStan. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes requested
The translation fix works for all three builders, but the new test bodies repeat cleanup that tear_down already does.
Validation details
- Files reviewed: 6/6 changed files.
Script_Translations_Testran on PHP 8.3, PHPUnit 9.6 and the WordPress 7.1 test library. All 3 tests pass at HEAD.- The same tests ran with the three
includes/files restored frompr-base. Each test failed on its text domain assertion. - Beaver Builder Lite 2.11.0.6 calls
enqueue_scripts()before it enqueues$module->json both the layout and builder UI paths. The test stub uses the same order. - The security review found no trust boundary change. The
tests/folder is excluded from the release package.
Untested areas
- Translation loading with a real language pack and generated JSON files was not checked.
- The Elementor and Beaver Builder screens were not opened in a browser.
🤖 Automated review · run code-review-agent_6abb8fe0464847.36587835.
🤖 Review agent — review posted ✅ on 8fc6172c · changes requested · 1 finding · 8 min
Run code-review-agent_6abb8fe0464847.36587835 · trail
There was a problem hiding this comment.
🟢 Approved
The PR passes because the duplicate test cleanup is removed and all three builder scripts still get the text domain.
Validation details
- Files reviewed: 6/6 changed files. The only new commit is
ee3df6c. Script_Translations_Testran on PHP 8.3, PHPUnit 9.6.37 and WordPress 7.1.2. All 3 tests pass at HEAD, in default and reverse order.- With the
includes/files frompr-base, each test fails on its text domain assertion. - The Beaver Builder hook order and the security check come from run code-review-agent_6abb8fe0464847.36587835, not rerun. The new commit does not touch that code.
Untested areas
- Translation loading with a real language pack and generated JSON files was not checked.
- The Elementor and Beaver Builder screens were not opened in a browser.
🤖 Automated review · run code-review-agent_6abb9572a293d1.59928062.
🤖 Review agent — review posted ✅ on ee3df6cc · approved · 0 findings · 4 min
Run code-review-agent_6abb9572a293d1.59928062 · trail
There was a problem hiding this comment.
🔵 Needs a closer look
Dev review: Check editor/src/plugins/extension.js:215 and :316, because a translated compare string can hide the save-template error message.
Validation details
- Files reviewed: 7/7 changed files. The only new commit is
2249dac. - A GET to the Templates Cloud API returned HTTP 200 with
rest_forbiddenand an English message for every locale tried. - The de and fr plugin catalogs translate the neighbouring
extension.jsstrings. Script_Translations_Testresults come from run code-review-agent_6abb9572a293d1.59928062 atee3df6c, not rerun.
Untested areas
- Open
editor/src/plugins/extension.js:215. Does a refused save POST return an Englishmessagewithcode: rest_forbidden? If yes, a translated compare string breaks the match. Then compareres.codeassite-editor-extension.js:184does. A POST was not sent to production. - No test suite reaches the save-template error path.
🤖 Automated review · run code-review-agent_6abcf91f29e233.87658543.
🤖 Review agent — review posted ✅ on 2249daca · commented · 0 findings · 11 min
Run code-review-agent_6abcf91f29e233.87658543 · trail

Summary
Ensures that all builder scripts (Gutenberg, Elementor, and Beaver Builder) are properly linked to the plugin's text domain for translations. It also introduces a new test to verify that these scripts load their translations correctly. The most important changes are grouped by theme below.
Check before Pull Request is ready:
Closes #527