[wp-trac] [WordPress Trac] #42170: Incorrect use of _n() in /wp-includes/class-wp-customize-nav-menus.php

WordPress Trac noreply at wordpress.org
Tue Oct 10 20:19:43 UTC 2017


#42170: Incorrect use of _n() in /wp-includes/class-wp-customize-nav-menus.php
--------------------------+--------------------
 Reporter:  tobifjellner  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.9
Component:  Customize     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+--------------------

Comment (by SergeyBiryukov):

 Replying to [ticket:42170 tobifjellner]:
 > If the idea is to use these phrases ''without numbers'' then it´s better
 to simply translate the two phrases separately.

 Right, if the goal is to make sure `Menu Location` is only displayed for
 one location (not for 21, 31, etc. in some languages), `_n()` should not
 be used for that. An explicit check should be used instead:
 {{{
 if ( 1 === $num_locations ) {
         $title = __( 'Menu Location' );
 } else {
         $title = __( 'Menu Locations' );
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42170#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list