Repository navigation
Podcast: load the dashboard's JavaScript translations - #53042
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
bdf8c6c to
b56fa80
Compare
b56fa80 to
3f1cbdf
Compare
The wp-build Podcast dashboard shipped with its strings in English on non-English sites: nothing downloads its JS translation catalog at boot. This applies the same approach #50762 used for the other wp-build dashboards. - Add a boot `init` package that calls loadI18nCatalogs( 'jetpack-podcast' ). - Register it on the dashboard page and stamp the text domain / write the i18n manifest after wp-build. - Enqueue wp-jp-i18n-loader on the Podcast page. - Register the init script module directly when `wp_default_scripts` has already fired. The Podcast build is loaded on admin_menu, after that hook, so the generated registrar never ran and the init module was missing from the import map ("Failed to resolve module specifier"). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d registrar jetpack_podcast_register_script_modules() is defined by the generated build/modules.php, which Phan doesn't analyze. The call is already guarded by function_exists(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Moves the late script-module registration into a small method that takes the registrar as a parameter, so it can be tested without the generated build code (and no longer needs a Phan suppression). Adds tests for the loader enqueue and the registration. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3f1cbdf to
8edda1a
Compare
dlind1
left a comment
There was a problem hiding this comment.
LGTM! I made a small adjustment to match the other places where a similar fix was implemented.
This address this issue with the Jetpack Podcasts translations in WordPress.com not loading: I18N-372
Proposed changes
/wp-admin/admin.php?page=jetpack-podcast, and/settings/podcastingin Calypso) renders in English on non-English sites, even though its strings are already translated. Nothing downloads the dashboard's JS translation catalog at boot. This is the same gap wp-build dashboards: translate JavaScript strings (load catalogs + stamp text domains) #50762 closed for activity-log, publicize, videopress, backup, newsletter, forms and premium-analytics; Podcast wasn't in that list.projects/packages/podcast:packages/initboot module that callsloadI18nCatalogs( 'jetpack-podcast', import.meta.url ), registered on the dashboard page viawpPlugin.pages[].init.build:stamp-textdomainsafterwp-build, which stamps the text domain and writesbuild/i18n-manifest.json.Admin_Pageenqueueswp-jp-i18n-loader(guarded bywp_script_is( ..., 'registered' ), as Newsletter does).Admin_Page::load_wp_build()now callsjetpack_podcast_register_script_modules()directly whenwp_default_scriptshas already fired. Podcast loads its build onadmin_menupriority 1, after that hook, so the generated registrar never ran and@jetpack-podcast/initwas missing from the import map (console:Failed to resolve module specifier '@jetpack-podcast/init'). Newsletter loads its build earlier, so it isn't affected. The function has a run-once guard, so calling it directly is safe either way.jetpack-seoandjetpack-scan-pagealso lack ani18n-manifest.jsonand may have the same gap; I haven't verified that.Before

After

Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
/wp-admin/admin.php?page=jetpack-podcast.Failed to run boot init module: @jetpack-podcast/init.i18n-manifest.json, thenjetpack-<lang>-<hash>.json, and the page text is translated (e.g. "Il tuo podcast va pubblicato insieme al tuo blog").pnpm install(lockfile gains only thelink:entry),jp build packages/podcast --deps, ESLint, PHPCS,jp changelog validate. PHP unit tests were not run locally (they need Docker).🤖 Generated with Claude Code