Make WordPress Core


Ignore:
Timestamp:
07/07/2020 06:00:37 PM (5 years ago)
Author:
ocean90
Message:

I18N: Use wp.i18n for translatable strings in wp-admin/js/inline-edit-post.js and wp-admin/js/inline-edit-tax.js.

This removes the usage of wp_localize_script() for passing translations to the scripts and instead adds the translatable strings in the scripts directly through the use of wp.i18n and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50601.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r48387 r48391  
    12551255
    12561256        $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
    1257         did_action( 'init' ) && $scripts->localize(
    1258             'inline-edit-post',
    1259             'inlineEditL10n',
    1260             array(
    1261                 'error'      => __( 'Error while saving the changes.' ),
    1262                 'ntdeltitle' => __( 'Remove From Bulk Edit' ),
    1263                 'notitle'    => __( '(no title)' ),
    1264                 'comma'      => trim( _x( ',', 'tag delimiter' ) ),
    1265                 'saved'      => __( 'Changes saved.' ),
    1266             )
    1267         );
     1257        $scripts->set_translations( 'inline-edit-post' );
    12681258
    12691259        $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
    1270         did_action( 'init' ) && $scripts->localize(
    1271             'inline-edit-tax',
    1272             'inlineEditL10n',
    1273             array(
    1274                 'error' => __( 'Error while saving the changes.' ),
    1275                 'saved' => __( 'Changes saved.' ),
    1276             )
    1277         );
     1260        $scripts->set_translations( 'inline-edit-tax' );
    12781261
    12791262        $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.