[wp-trac] [WordPress Trac] #50235: wp-admin/js/updates.js: Use wp.i18n for JavaScript translations
WordPress Trac
noreply at wordpress.org
Sun May 24 11:57:43 UTC 2020
#50235: wp-admin/js/updates.js: Use wp.i18n for JavaScript translations
-------------------------+--------------------
Reporter: ocean90 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.5
Component: I18N | Version:
Severity: normal | Keywords:
Focuses: javascript |
-------------------------+--------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50235>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list