[wp-trac] [WordPress Trac] #11520: print_scripts_l10n() should use json_encode()

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 25 16:58:30 UTC 2011


#11520: print_scripts_l10n() should use json_encode()
------------------------------------+------------------------
 Reporter:  scribu                  |       Owner:  azaozz
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  3.3
Component:  JavaScript              |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------

Comment (by westi):

 Replying to [comment:25 azaozz]:
 > Replying to [comment:23 nacin]:
 > > add_script_data() is for adding script data. To me, it sounds less of
 a replacement, and more like a lower level of the API, like *_metadata().
 wp_localize_script() can be a wrapper.
 >
 > The deprecation here is only about the (old) names: `localize` and
 `..._l10n`. Even before this patch plugins were using wp_localize_script()
 to add arbitrary JS data. On the other hand having two different functions
 that do exactly the same thing may be confusing.

 I don't see why we have done this deprecation.

 The function name was better and we didn't need to do it - can't we keep
 the old function name and just do the switch to json here?

 With this new code can we do away with the l10n.js file now too?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11520#comment:26>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list