#50235 closed enhancement (fixed)
Use wp.i18n for translatable strings in wp-admin/js/updates.js
| Reported by: | ocean90 | Owned by: | ocean90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5 |
| Component: | I18N | Version: | |
| Severity: | normal | Keywords: | has-patch has-dev-note |
| Cc: | Focuses: | javascript |
Description
JavaScript translation support is available since 5.0 (#45103) and so far only used in the block editor, site health, and media views. Other scripts are still using the old way via wp_localize_script().
Issues, that a switch to wp.i18n would solve:
- The current way in script-loader.php (
did_action( 'init' ) && $scripts->localize()initializes all the translations even if the script isn't used. wp_localize_script()has no proper support for plural forms.- Since script-loader.php is in wp-includes the translations are all part of the front-end PO/MO files while some of them are only used in wp-admin.
Therefore I'm proposing to increase the usage of wp.i18n. The change should be processed file by file.
This ticket is for wp-admin/js/updates.js.
Change History (7)
This ticket was mentioned in PR #294 on WordPress/wordpress-develop by ocean90.
6 years ago
#1
- Keywords has-patch added
#3
follow-up:
↓ 4
@
6 years ago
Am I correct in thinking that the script registration should have been updated to include wp-i18n as a dependency of the updates script handle?
#4
in reply to: ↑ 3
@
6 years ago
Replying to aduth:
Am I correct in thinking that the script registration should have been updated to include
wp-i18nas a dependency of theupdatesscript handle?
WP_Scripts::set_translations() handles that for us.
#5
@
6 years ago
- Summary wp-admin/js/updates.js: Use wp.i18n for JavaScript translations → Use wp.i18n for translatable strings in wp-admin/js/updates.js
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/50235