[wp-trac] [WordPress Trac] #56425: wp_localize_script assign to const and freeze instead of var to avoid reassignments
WordPress Trac
noreply at wordpress.org
Mon Nov 7 22:12:20 UTC 2022
#56425: wp_localize_script assign to const and freeze instead of var to avoid
reassignments
-----------------------------------+------------------------------
Reporter: malthert | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses: javascript
-----------------------------------+------------------------------
Comment (by TimothyBlynJacobs):
> Could you perhaps give 2-3 examples of those?
I've seen developers write back to their global if values are empty.
{{{
myPluginVar.KEY = myPluginVar.KEY || 'My Default Value'
}}}
> so I'm not sure if it's really advisable to promote this for very basic
text translations
For localization developers should be moving to `wp.i18n`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56425#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list