Make WordPress Core

Changeset 59428


Ignore:
Timestamp:
11/20/2024 01:53:57 AM (20 months ago)
Author:
desrosj
Message:

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.

Location:
branches/6.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.7

  • branches/6.7/src/js/_enqueues/lib/nav-menu.js

    r59265 r59428  
    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() {
     
    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
     
    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
Note: See TracChangeset for help on using the changeset viewer.