WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#42112 closed defect (bug) (fixed)

Customize Menus: Adjust "Menu Locations" labels for singular/plural

Reported by: melchoyce Owned by: westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.9
Component: Customize Keywords: has-patch commit
Focuses: ui Cc:

Description

Currently, "Menu Locations" is plural even if you only have one location to assign menus to.

Attachments (1)

42112.diff (1.6 KB) - added by felipeelia 2 years ago.

Download all attachments as: .zip

Change History (11)

#1 @melchoyce
3 years ago

  • Owner set to bpayton
  • Status changed from new to assigned

@felipeelia
2 years ago

#2 @felipeelia
2 years ago

  • Keywords has-patch added

I talked about this with @bpayton at slack and I've uploaded a patch (trying) to help. Note that it also changes View All Locations to View Location when there is only one of them.

#3 @melchoyce
2 years ago

Looks good to me!

#4 follow-up: @westonruter
2 years ago

It looks good to me too, but @felipeelia why introduce a new template variable for locationsTitle when it could just replace the _e() call with an echo _n() in tmpl-nav-menu-locations-header?

#5 in reply to: ↑ 4 ; follow-up: @felipeelia
2 years ago

Replying to westonruter:

It looks good to me too, but @felipeelia why introduce a new template variable for locationsTitle when it could just replace the _e() call with an echo _n() in tmpl-nav-menu-locations-header?

Hi @westonruter :)
I think it couldn't be replaced by _n directly because we don't have the number of locations avaiable inside print_templates() function. Please correct me if I'm wrong.

#6 @bpayton
2 years ago

I was happy to see the new variable because I was planning to introduce it anyway to share it with class-wp-customize-nav-menu-locations-control.php.

#7 @bpayton
2 years ago

We need to fix that title as well, but I can fix that as part of #42113.

#8 in reply to: ↑ 5 @westonruter
2 years ago

  • Keywords commit added
  • Owner changed from bpayton to westonruter
  • Status changed from assigned to accepted

Replying to felipeelia:

I think it couldn't be replaced by _n directly because we don't have the number of locations avaiable inside print_templates() function. Please correct me if I'm wrong.

The printing of templates would happen even after enqueue_scripts, so the number of registered nav menus would for sure be known at that point. But since @bpayton would like to re-use the string, the patch is good as is.

#9 @westonruter
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 41812:

Customize: Adjust "Menu Locations" labels for singular/plural.

Props felipeelia.
Fixes #42112.

#10 @westonruter
2 years ago

In 41816:

Customize: Fix string translations for singular vs plural after [41812].

Props felipeelia, tobifjellner, SergeyBiryukov.
See #42112.
Fixes #42170.

Note: See TracTickets for help on using tickets.