I18N: Use wp.i18n
for translatable strings in wp-includes/js/wp-pointer.js
.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities. Props swissspidy, ocean90. See #20491. Fixes #50525. git-svn-id: https://develop.svn.wordpress.org/trunk@48266 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f3f7b77522
commit
ad03cf3f72
@ -2,8 +2,6 @@
|
||||
* @output wp-includes/js/wp-pointer.js
|
||||
*/
|
||||
|
||||
/* global wpPointerL10n */
|
||||
|
||||
/**
|
||||
* Initializes the wp-pointer widget using jQuery UI Widget Factory.
|
||||
*/
|
||||
@ -19,8 +17,7 @@
|
||||
return $(this).text();
|
||||
},
|
||||
buttons: function( event, t ) {
|
||||
var close = ( wpPointerL10n ) ? wpPointerL10n.dismiss : 'Dismiss',
|
||||
button = $('<a class="close" href="#">' + close + '</a>');
|
||||
var button = $('<a class="close" href="#"></a>').text( wp.i18n.__( 'Dismiss' ) );
|
||||
|
||||
return button.bind( 'click.pointer', function(e) {
|
||||
e.preventDefault();
|
||||
|
@ -688,14 +688,8 @@ function wp_default_scripts( $scripts ) {
|
||||
)
|
||||
);
|
||||
|
||||
$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
'wp-pointer',
|
||||
'wpPointerL10n',
|
||||
array(
|
||||
'dismiss' => __( 'Dismiss' ),
|
||||
)
|
||||
);
|
||||
$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 );
|
||||
$scripts->set_translations( 'wp-pointer' );
|
||||
|
||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user