diff --git a/src/js/_enqueues/lib/nav-menu.js b/src/js/_enqueues/lib/nav-menu.js index 9f404f31a0..3371606933 100644 --- a/src/js/_enqueues/lib/nav-menu.js +++ b/src/js/_enqueues/lib/nav-menu.js @@ -9,7 +9,7 @@ * @output wp-admin/js/nav-menu.js */ -/* global menus, postboxes, columns, isRtl, navMenuL10n, ajaxurl, wpNavMenu */ +/* global menus, postboxes, columns, isRtl, ajaxurl, wpNavMenu */ (function($) { @@ -588,7 +588,7 @@ if ( title ) { titleEl.text( title ).removeClass( 'no-title' ); } else { - titleEl.text( navMenuL10n.untitled ).addClass( 'no-title' ); + titleEl.text( wp.i18n._x( '(no label)', 'missing menu item navigation label' ) ).addClass( 'no-title' ); } } ); }, @@ -1050,7 +1050,7 @@ if ( 0 !== $('#menu-to-edit').length || 0 !== $('.menu-location-menus select').length ) { window.onbeforeunload = function(){ if ( api.menusChanged ) - return navMenuL10n.saveAlert; + return wp.i18n.__( 'The changes you made will be lost if you navigate away from this page.' ); }; } else { // Make the post boxes read-only, as they can't be used yet. @@ -1220,7 +1220,7 @@ eventOnClickMenuDelete : function() { // Delete warning AYS. - if ( window.confirm( navMenuL10n.warnDeleteMenu ) ) { + if ( window.confirm( wp.i18n.__( 'You are about to permanently delete this menu.\n\'Cancel\' to stop, \'OK\' to delete.' ) ) ) { window.onbeforeunload = null; return true; } @@ -1253,7 +1253,7 @@ $item; if( ! $items.length ) { - $('.categorychecklist', panel).html( '
  • ' + navMenuL10n.noResultsFound + '

  • ' ); + $('.categorychecklist', panel).html( '
  • ' + wp.i18n.__( 'No results found.' ) + '

  • ' ); $( '.spinner', panel ).removeClass( 'is-active' ); wrapper.addClass( 'has-no-menu-item' ); return; diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index a98c2ed29c..cc24a17aa2 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1312,16 +1312,7 @@ function wp_default_scripts( $scripts ) { * see https://core.trac.wordpress.org/ticket/42321 */ $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2', 'underscore' ) ); - did_action( 'init' ) && $scripts->localize( - 'nav-menu', - 'navMenuL10n', - array( - 'noResultsFound' => __( 'No results found.' ), - 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ), - 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), - 'untitled' => _x( '(no label)', 'missing menu item navigation label' ), - ) - ); + $scripts->set_translations( 'nav-menu' ); $scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 ); $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );