Skip to content

Fix: Replace deprecated wp.updates.l10n.updating with wp.i18n.__ - #10896

Open
manishdhorepatil-art wants to merge 23 commits into
WordPress:trunkfrom
manishdhorepatil-art:64619-deprecated-wp-updates-l10n
Open

Fix: Replace deprecated wp.updates.l10n.updating with wp.i18n.__#10896
manishdhorepatil-art wants to merge 23 commits into
WordPress:trunkfrom
manishdhorepatil-art:64619-deprecated-wp-updates-l10n

Conversation

@manishdhorepatil-art

Copy link
Copy Markdown

Fixes a deprecated JavaScript usage in the WordPress admin.

The code in wp-admin/js/theme.js was using wp.updates.l10n.updating, which has been deprecated since WordPress 5.5. This PR replaces it with the recommended wp.i18n.__() function.

Testing Instructions

Go to Dashboard → Updates or Appearance → Themes

Trigger a theme update

Confirm:

The text “Updating...” appears correctly

No deprecation notice appears in the browser console

Trac Ticket

Fixes: https://core.trac.wordpress.org/ticket/64619

   Replaces deprecated wp.updates.l10n.updating with wp.i18n.__( 'Updating...' ) in theme.js to resolve deprecation notice.

   Props: [Your WordPress.org username]
   Fixes #64619
@github-actions

github-actions Bot commented Feb 10, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props manishxdp, wildworks, westonruter, huzaifaalmesbah, ozgursar.

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

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@westonruter

Copy link
Copy Markdown
Member

I see there are quite a few reads of the l10n object as well. Should those not be updated as well?

@westonruter

Copy link
Copy Markdown
Member

There is a seeming duplicate PR opened at the same time: #10895. Should this be close in favor of that, or the other way around?

@manishdhorepatil-art

manishdhorepatil-art commented Feb 11, 2026

Copy link
Copy Markdown
Author

Thanks for the review, @westonruter.
I checked theme.js and found that line 1280 already uses wp.i18n.__('Updating...') instead of wp.updates.l10n.updating. I didn't find other direct references to wp.updates.l10n in this file.
Could you point to the specific instances you're seeing? I can:
Check other files if they're outside theme.js

@westonruter

westonruter commented Feb 11, 2026

Copy link
Copy Markdown
Member

Here:

.append( $.parseHTML( '<label for="wp-filter-search-input">' + l10n.search + '</label>' ) )

$button.attr({ 'aria-expanded': 'false', 'aria-label': l10n.expandSidebar });
} else {
$button.attr({ 'aria-expanded': 'true', 'aria-label': l10n.collapseSidebar });

And so on.

@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter Could you please checknow added nessary changes

Comment thread src/js/_enqueues/wp/theme.js Outdated
@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter what else changes are necessary

Comment thread src/wp-admin/themes.php
Comment thread src/wp-admin/theme-install.php
Comment thread src/js/_enqueues/wp/theme.js Outdated
@westonruter

Copy link
Copy Markdown
Member

I'm not an expert on i18n in JS, so it will be best for someone else who has more experience to provide final review, but I'm sharing what I believe needs to be done.

@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter done please check now

@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter can you check now done suggested changes

@westonruter

Copy link
Copy Markdown
Member

@manishdhorepatil-art That looks correct. I'll leave for another contributor who has I18N expertise to confirm.

@westonruter

Copy link
Copy Markdown
Member

Please don't keep merging trunk into this branch. It's not necessary unless there is a merge conflict. Please wait for another reviewer.

@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter do we need any changes to this ticket ?

@westonruter

Copy link
Copy Markdown
Member

I don't know. It's waiting for another reviewer.

@westonruter

Copy link
Copy Markdown
Member

Please don't keep merging trunk into this branch. It's not necessary unless there is a merge conflict. Please wait for another reviewer.

@manishdhorepatil-art

manishdhorepatil-art commented Mar 4, 2026

Copy link
Copy Markdown
Author

@huzaifaalmesbah can you pls review this
track - https://core.trac.wordpress.org/ticket/64619

@huzaifaalmesbah

Copy link
Copy Markdown
Member

Hi @manishdhorepatil-art,
I see that @westonruter has already reviewed this and mentioned it is waiting for another reviewer with more i18n expertise. So it’s better to wait for a committer or component maintainer to review it.

No need to rush or worry too much. please wait for the appropriate reviewer.

@ozgursar

ozgursar commented Mar 4, 2026

Copy link
Copy Markdown

While searching for l10n.updating I found that it's also being used in /js/_enqueues/wp/customize/controls.js as follows on line 7296

section.contentContainer.find( '.customize-action' ).text( api.l10n.updating );

I'm not sure whether this should be fixed as well.

@manishdhorepatil-art

Copy link
Copy Markdown
Author

@westonruter its been long are there any changes in the pr expected

Copilot AI review requested due to automatic review settings July 27, 2026 12:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Themes admin JavaScript to avoid a deprecated wp.updates.l10n.updating usage by switching relevant UI strings to wp.i18n APIs, and wires up script translations so those strings can be localized.

Changes:

  • Removes _wpThemeSettings.l10n injections from themes.php and theme-install.php, and enables script translations for the theme script.
  • Replaces several theme browser UI strings (including “Updating…”) in src/js/_enqueues/wp/theme.js with wp.i18n.__() / wp.i18n.sprintf() calls.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/wp-admin/themes.php Removes localized l10n blob and enables script translations for the Themes admin JS.
src/wp-admin/theme-install.php Removes localized l10n blob and enables script translations for the Theme Install admin JS.
src/js/_enqueues/wp/theme.js Replaces various l10n lookups (including deprecated updating text) with wp.i18n calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wp-admin/themes.php
Comment thread src/wp-admin/theme-install.php
Comment thread src/js/_enqueues/wp/theme.js Outdated
Comment thread src/js/_enqueues/wp/theme.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 28, 2026 03:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/wp-admin/themes.php:239

  • theme.js now calls wp.i18n.__()/wp.i18n.sprintf(), but the core script registration for the theme handle (in wp-includes/script-loader.php) does not declare a wp-i18n dependency or translations. The per-screen wp_set_script_translations( 'theme' ) calls will cover core screens, but enqueuing the theme handle elsewhere (e.g., by plugins) can now fail with wp.i18n undefined. Consider moving translations setup to the script registration (e.g., $scripts->set_translations( 'theme' ); next to the theme handle registration, or add wp-i18n to the deps array) and then dropping the per-screen calls.
wp_enqueue_script( 'theme' );
wp_set_script_translations( 'theme' );
wp_enqueue_script( 'updates' );

src/wp-admin/theme-install.php:63

  • Same as on themes.php: relying on wp_set_script_translations( 'theme' ) at the screen level means the theme script’s wp-i18n dependency is not guaranteed when theme is enqueued elsewhere. This can cause runtime errors after introducing direct wp.i18n.* calls in theme.js. Prefer setting translations/deps at registration time in src/wp-includes/script-loader.php for the theme handle.
wp_enqueue_script( 'theme' );
wp_set_script_translations( 'theme' );
wp_enqueue_script( 'updates' );

src/js/_enqueues/wp/theme.js:1680

  • The support forums URL was previously passed through __() on the PHP side (so locales could override it). This change hard-codes the URL in JS, which removes that localization capability. Pass the URL through wp.i18n.__() before sprintf() to preserve the existing translatable URL behavior.
			/* translators: %s: Support forums URL. */
			$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="notice notice-error"><p>' + wp.i18n.sprintf( wp.i18n.__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), 'https://wordpress.org/support/forums/' ) + '</p><p><button class="button try-again">' + wp.i18n.__( 'Try Again' ) + '</button></p></div>' );

Copilot AI review requested due to automatic review settings July 29, 2026 03:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/js/_enqueues/wp/theme.js:1724

  • The support forums URL is hard-coded here, but the PHP localized string uses a translatable URL (see wp-admin/theme-install.php where __( 'https://wordpress.org/support/forums/' ) is passed into the message). To preserve locale-specific URLs, make the URL translatable in JS as well (or continue using the localized l10n.error).
			$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="notice notice-error"><p>' + wp.i18n.sprintf( wp.i18n.__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), 'https://wordpress.org/support/forums/' ) + '</p><p><button class="button try-again">' + wp.i18n.__( 'Try Again' ) + '</button></p></div>' );

Comment thread src/js/_enqueues/wp/theme.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants