[wp-trac] [WordPress Trac] #49484: Add option 'OR' to wp_sprintf_l()

WordPress Trac noreply at wordpress.org
Fri Feb 21 15:46:09 UTC 2020


#49484: Add option 'OR' to wp_sprintf_l()
-----------------------------+------------------------------
 Reporter:  pedromendonca    |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Formatting       |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------------------

Comment (by pedromendonca):

 = **Usage and testing** =

 **Normal placeholders**
 {{{
 wp_sprintf(
         'Test default: %l | Test OR: %l$o | Test AND: %l$a',
         array( 1, 3, 5, 7 ),
         array( 2, 4, 6, 8 ),
         array( 10, 20, 30, 40 )
 );
 }}}

 **Numbered placeholders**
 {{{
 wp_sprintf(
         'Test default: %1$l | Test OR: %2$l$o | Test AND: %3$l$a',
         array( 1, 3, 5, 7 ),
         array( 2, 4, 6, 8 ),
         array( 10, 20, 30, 40 )
 );
 }}}


 Output: `Test default: 1, 3, 5, and 7 | Test OR: 2, 4, 6, or 8 | Test AND:
 10, 20, 30, and 40`


 **Arrays of only 2 items**
 {{{
 wp_sprintf(
         'Test default: %l | Test OR: %l$o | Test AND: %l$a',
         array( 1, 3 ),
         array( 2, 4 ),
         array( 10, 20 )
 );
 }}}
 Output: `Test default: 1 and 3 | Test OR: 2 or 4 | Test AND: 10 and 20`

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


More information about the wp-trac mailing list