| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Pages built by wp-build (e.g. the AI settings page) enqueue their JS as script modules. wp_set_script_translations() only applies to classic scripts, so route JS strings such as "Enable AI" stayed untranslated even though correctly named JSON translation files were present. Register the `ai` text domain for the route content module via wp_set_script_module_translations() (WordPress 7.0+) so those strings are localized. Also ignore the not-yet-stubbed function in PHPStan, matching the existing handling of other WP 7.0 functions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## develop #613 +/- ##
=============================================
- Coverage 73.18% 73.16% -0.02%
- Complexity 1731 1732 +1
=============================================
Files 85 85
Lines 7473 7476 +3
=============================================
+ Hits 5469 5470 +1
- Misses 2004 2006 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
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: t-hamano <wildworks@git.wordpress.org> To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What?
Follow up to #582
Localize the JS strings on the settings page, which were still rendered in English even after #582.
Why?
#582 fixed JS translation loading by calling wp_set_script_translations() for every script enqueued through Asset_Loader::enqueue_script(). That covers classic scripts, but the settings page and other wp-build routes are enqueued as script modules*, which wp_set_script_translations() does not apply to.
How?
Register the ai text domain for the route content script module via wp_set_script_module_translations(). For the background of this function's addition, please refer to https://core.trac.wordpress.org/ticket/65015#comment:45.
PHPStan does not yet ship a stub for wp_set_script_module_translations(), so it is added to the existing WP 7.0 ignoreErrors list.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Tracing the script module i18n path through WordPress core and drafting the fix. All changes were reviewed and verified by me.
Testing Instructions
Screenshots or screencast
Before
After
Changelog Entry