diff --git a/src/js/_enqueues/admin/inline-edit-post.js b/src/js/_enqueues/admin/inline-edit-post.js index f997e17f14..5f3d2212e2 100644 --- a/src/js/_enqueues/admin/inline-edit-post.js +++ b/src/js/_enqueues/admin/inline-edit-post.js @@ -5,7 +5,7 @@ * @output wp-admin/js/inline-edit-post.js */ -/* global inlineEditL10n, ajaxurl, typenow, inlineEditPost */ +/* global ajaxurl, typenow, inlineEditPost */ window.wp = window.wp || {}; @@ -198,8 +198,8 @@ window.wp = window.wp || {}; if ( $(this).prop('checked') ) { c = false; var id = $(this).val(), theTitle; - theTitle = $('#inline_'+id+' .post_title').html() || inlineEditL10n.notitle; - te += '
X'+theTitle+'
'; + theTitle = $('#inline_'+id+' .post_title').html() || wp.i18n.__( '(no title)' ); + te += '
X'+theTitle+'
'; } }); @@ -327,7 +327,7 @@ window.wp = window.wp || {}; var terms = $(this), taxname = $(this).attr('id').replace('_' + id, ''), textarea = $('textarea.tax_input_' + taxname, editRow), - comma = inlineEditL10n.comma; + comma = wp.i18n._x( ',', 'tag delimiter' ).trim(); terms.find( 'img' ).replaceWith( function() { return this.alt; } ); terms = terms.text(); @@ -431,7 +431,7 @@ window.wp = window.wp || {}; $( this ).find( '.editinline' ) .attr( 'aria-expanded', 'false' ) .focus(); - wp.a11y.speak( inlineEditL10n.saved ); + wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) ); }); } else { r = r.replace( /<.[^<>]*?>/g, '' ); @@ -441,8 +441,8 @@ window.wp = window.wp || {}; } } else { $errorNotice.removeClass( 'hidden' ); - $error.html( inlineEditL10n.error ); - wp.a11y.speak( inlineEditL10n.error ); + $error.text( wp.i18n.__( 'Error while saving the changes.' ) ); + wp.a11y.speak( wp.i18n.__( 'Error while saving the changes.' ) ); } }, 'html'); diff --git a/src/js/_enqueues/admin/inline-edit-tax.js b/src/js/_enqueues/admin/inline-edit-tax.js index 5a3cad885c..b49f6c59b1 100644 --- a/src/js/_enqueues/admin/inline-edit-tax.js +++ b/src/js/_enqueues/admin/inline-edit-tax.js @@ -4,7 +4,7 @@ * @output wp-admin/js/inline-edit-tax.js */ -/* global inlineEditL10n, ajaxurl, inlineEditTax */ +/* global ajaxurl, inlineEditTax */ window.wp = window.wp || {}; @@ -224,7 +224,7 @@ window.inlineEditTax = { row.find( '.editinline' ) .attr( 'aria-expanded', 'false' ) .focus(); - wp.a11y.speak( inlineEditL10n.saved ); + wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) ); }); } else { @@ -238,8 +238,8 @@ window.inlineEditTax = { } } else { $errorNotice.removeClass( 'hidden' ); - $error.html( inlineEditL10n.error ); - wp.a11y.speak( inlineEditL10n.error ); + $error.text( wp.i18n.__( 'Error while saving the changes.' ) ); + wp.a11y.speak( wp.i18n.__( 'Error while saving the changes.' ) ); } } ); diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index edc0afef7f..a9dcf930cb 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1254,27 +1254,10 @@ function wp_default_scripts( $scripts ) { $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 ); $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 ); - did_action( 'init' ) && $scripts->localize( - 'inline-edit-post', - 'inlineEditL10n', - array( - 'error' => __( 'Error while saving the changes.' ), - 'ntdeltitle' => __( 'Remove From Bulk Edit' ), - 'notitle' => __( '(no title)' ), - 'comma' => trim( _x( ',', 'tag delimiter' ) ), - 'saved' => __( 'Changes saved.' ), - ) - ); + $scripts->set_translations( 'inline-edit-post' ); $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); - did_action( 'init' ) && $scripts->localize( - 'inline-edit-tax', - 'inlineEditL10n', - array( - 'error' => __( 'Error while saving the changes.' ), - 'saved' => __( 'Changes saved.' ), - ) - ); + $scripts->set_translations( 'inline-edit-tax' ); $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 ); did_action( 'init' ) && $scripts->localize(