Skip to content

Commit e1d1493

Browse files
committed
Menus: i18n: Fix untranslatable strings in nav-menu.js.
Wrap three untranslatable strings in nav menus in JS translation functions. Follow up to [59265]. Props juliemoynat, swissspidy, yogeshbhutkar, sergeybiryukov, desrosj, tobifjellner, audrasjb, joedolson. Fixes #62402. git-svn-id: https://develop.svn.wordpress.org/trunk@59426 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7f26841 commit e1d1493

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/js/_enqueues/lib/nav-menu.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
$selected = 'selected';
320320
}
321321

322-
$html += '<option ' + $selected + ' value="0">No Parent</option>';
322+
$html += '<option ' + $selected + ' value="0">' + wp.i18n._x( 'No Parent', 'menu item without a parent in navigation menu' ) + '</option>';
323323

324324
$.each( menuItems, function() {
325325
var menuItem = $(this),
@@ -364,7 +364,13 @@
364364
if ( i == itemPosition ) {
365365
$selected = 'selected';
366366
}
367-
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalMenuItems + '</option>';
367+
// Translators: %1$s is the current menu item number, %2$s is the total number of menu items.
368+
var itemString = wp.i18n.sprintf(
369+
wp.i18n._x( '%1$s of %2$s', 'indicating a part of a total number of items in a navigation menu' ),
370+
i,
371+
totalMenuItems
372+
);
373+
$html += '<option ' + $selected + ' value="' + i + '">' + itemString + '</option>';
368374
}
369375

370376
} else {
@@ -380,7 +386,13 @@
380386
if ( i == itemPosition ) {
381387
$selected = 'selected';
382388
}
383-
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalSubMenuItems + '</option>';
389+
// Translators: %1$s is the current submenu item number, %2$s is the total number of submenu items.
390+
var submenuString = wp.i18n.sprintf(
391+
wp.i18n._x( '%1$s of %2$s', 'indicating a part of a total number of items in a submenu' ),
392+
i,
393+
totalSubMenuItems
394+
);
395+
$html += '<option ' + $selected + ' value="' + i + '">' + submenuString + '</option>';
384396
}
385397

386398
}

0 commit comments

Comments
 (0)