WordPress.org

Make WordPress Core

Changeset 48266


Ignore:
Timestamp:
07/01/2020 07:28:14 PM (10 months ago)
Author:
ocean90
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/pointer.js

    r47122 r48266  
    22 * @output wp-includes/js/wp-pointer.js
    33 */
    4 
    5 /* global wpPointerL10n */
    64
    75/**
     
    2018            },
    2119            buttons: function( event, t ) {
    22                 var close  = ( wpPointerL10n ) ? wpPointerL10n.dismiss : 'Dismiss',
    23                     button = $('<a class="close" href="#">' + close + '</a>');
     20                var button = $('<a class="close" href="#"></a>').text( wp.i18n.__( 'Dismiss' ) );
    2421
    2522                return button.bind( 'click.pointer', function(e) {
  • trunk/src/wp-includes/script-loader.php

    r48265 r48266  
    689689    );
    690690
    691     $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
    692     did_action( 'init' ) && $scripts->localize(
    693         'wp-pointer',
    694         'wpPointerL10n',
    695         array(
    696             'dismiss' => __( 'Dismiss' ),
    697         )
    698     );
     691    $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 );
     692    $scripts->set_translations( 'wp-pointer' );
    699693
    700694    $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.