#50235 closed enhancement (fixed)
Use wp.i18n for translatable strings in wp-admin/js/updates.js
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.5 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | I18N | Keywords: | has-patch has-dev-note |
| Focuses: | javascript | Cc: |
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
#2
@
6 years ago
- Owner set to ocean90
- Resolution set to fixed
- Status changed from new to closed
In 47884:
#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
@
5 years ago
- Summary changed from wp-admin/js/updates.js: Use wp.i18n for JavaScript translations to Use wp.i18n for translatable strings in wp-admin/js/updates.js
Trac ticket: https://core.trac.wordpress.org/ticket/50235