[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg

WordPress Trac noreply at wordpress.org
Fri Nov 12 03:25:30 UTC 2021


#32315: $wpdb->insert fails without error msg
-------------------------------------------------+-------------------------
 Reporter:  dlt101                               |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.9
Component:  Database                             |     Version:  4.2.1
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback has-patch has-unit-     |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:53 anand.au14]:
 > @davidbaumwald
 >
 > I liked your idea but upon exploring about it further I came across some
 recommendations given for when to use _n. So just got little bit confused.
 >
 >    this functions should NOT be use in one item or more than one item
 scenarios, but for singular form and plural forms, which is not the same
 thing
 >
 > Some reference links of initial quotes by @SergeyBiryukov are here in
 this comment
 > https://developer.wordpress.org/reference/functions/_n/#comment-2397
 >
 > @SergeyBiryukov Can you check if it is valid to use _n in this case? I
 will update the patch if required.

 You're right, a `1 === count( ... )` condition is exactly what's needed
 for a "one item vs. more than one item" scenario. Using `_n()` would not
 be appropriate here, as it's meant for a "singular form vs. plural forms"
 scenario. However, some languages use a singular form for numbers other
 than 1.

 This is also covered in the
 [https://developer.wordpress.org/plugins/internationalization/how-to-
 internationalize-your-plugin/#plurals plugin i18n handbook]:
 > Note that some languages use the singular form for other numbers (e.g.
 21, 31 and so on, much like ’21st’, ’31st’ in English). If you would like
 to special case the singular, check for it specifically:
 > {{{
 > if ( 1 === $count ) {
 >     printf( esc_html__( 'Last thing!', 'my-text-domain' ), $count );
 > } else {
 >     printf( esc_html( _n( '%d thing.', '%d things.', $count, 'my-text-
 domain' ) ), $count );
 > }
 > }}}

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


More information about the wp-trac mailing list