WordPress.org

Make WordPress Core

Changeset 48285


Ignore:
Timestamp:
07/03/2020 07:03:23 PM (11 months ago)
Author:
ocean90
Message:

I18N: Use wp.i18n for translatable strings in wp-includes/js/wp-auth-check.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 #50553.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/auth-check.js

    r48056 r48285  
    2424            // Add unload confirmation to counter (frame-busting) JS redirects.
    2525            $(window).on( 'beforeunload.wp-auth-check', function(e) {
    26                 e.originalEvent.returnValue = window.authcheckL10n.beforeunload;
     26                e.originalEvent.returnValue = wp.i18n.__( 'Your session has expired. You can log in again from this page or go to the login page.' );
    2727            });
    2828
  • trunk/src/wp-includes/script-loader.php

    r48276 r48285  
    700700
    701701    $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
    702     did_action( 'init' ) && $scripts->localize(
    703         'wp-auth-check',
    704         'authcheckL10n',
    705         array(
    706             'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
    707         )
    708     );
     702    $scripts->set_translations( 'wp-auth-check' );
    709703
    710704    $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.