Menus: i18n: Fix untranslatable strings in `nav-menu.js`.

Wrap three untranslatable strings in nav menus in JS translation functions.

Follow up to [59265].

Reviewed by desrosj, joedolson.
Merges 59426 to the 6.7 branch.

Props juliemoynat, swissspidy, yogeshbhutkar, sergeybiryukov, desrosj, tobifjellner, audrasjb, joedolson.
Fixes #62402.
Built from https://develop.svn.wordpress.org/branches/6.7@59428


git-svn-id: http://core.svn.wordpress.org/branches/6.7@58814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2024-11-20 01:55:18 +00:00
parent 7aaf81c7cc
commit 720cc884d9
3 changed files with 17 additions and 5 deletions

View File

@ -319,7 +319,7 @@
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="0">No Parent</option>'; $html += '<option ' + $selected + ' value="0">' + wp.i18n._x( 'No Parent', 'menu item without a parent in navigation menu' ) + '</option>';
$.each( menuItems, function() { $.each( menuItems, function() {
var menuItem = $(this), var menuItem = $(this),
@ -364,7 +364,13 @@
if ( i == itemPosition ) { if ( i == itemPosition ) {
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalMenuItems + '</option>'; // Translators: %1$s is the current menu item number, %2$s is the total number of menu items.
var itemString = wp.i18n.sprintf(
wp.i18n._x( '%1$s of %2$s', 'indicating a part of a total number of items in a navigation menu' ),
i,
totalMenuItems
);
$html += '<option ' + $selected + ' value="' + i + '">' + itemString + '</option>';
} }
} else { } else {
@ -380,7 +386,13 @@
if ( i == itemPosition ) { if ( i == itemPosition ) {
$selected = 'selected'; $selected = 'selected';
} }
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalSubMenuItems + '</option>'; // Translators: %1$s is the current submenu item number, %2$s is the total number of submenu items.
var submenuString = wp.i18n.sprintf(
wp.i18n._x( '%1$s of %2$s', 'indicating a part of a total number of items in a submenu' ),
i,
totalSubMenuItems
);
$html += '<option ' + $selected + ' value="' + i + '">' + submenuString + '</option>';
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7.1-alpha-59423'; $wp_version = '6.7.1-alpha-59428';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.