Changes between Version 1 and Version 2 of Ticket #21547, comment 2
- Timestamp:
- 08/11/2012 07:23:22 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #21547, comment 2
v1 v2 6 6 It's not necessarily for internationalization. In my case, at Automattic, the WordPress.com plugin I was working on uses wp_localize_script to pass dynamic properties to a static javascript file. 7 7 8 Here's the specific scenario: we run multiple a/b tests each of which needs some dynamic parameters passed to a static javascript file. Each of these a/b enqueues the static javascript file if it's not already been enqueued.8 Here's the specific scenario: we run multiple a/b tests each of which needs some dynamic parameters passed to a static javascript file. Each of these a/b tests enqueues the static javascript file if it's not already been enqueued. 9 9 10 10 The current implementation of wp_localize_script simply creates a new JS object each time it's called. A developer (like me in this case) might want to modify the existing JS object instead of creating a new one. It's easy to simply delocalize the script by passing the handle and calling wp_localize_script one more time.