WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34307 closed defect (bug) (fixed)

Incorrect use of _n_noop() on the About page

Reported by: johnbillion Owned by: ocean90
Milestone: 4.4 Priority: normal
Severity: minor Version:
Component: I18N Keywords: has-patch
Focuses: Cc:
PR Number:

Description

_n() and _n_noop() are used to provide the singular and plural form of the same string. They should not be used when the singular string and the plural string are effectively different strings. Sergey explains it well here.

On wp-admin/about.php, _n_noop() is used incorrectly as it's providing strings which differ depending on whether the number is singular or plural.

_n_noop( 'Maintenance Release', 'Maintenance Releases' );
_n_noop( 'Security Release', 'Security Releases' );
_n_noop( 'Maintenance and Security Release', 'Maintenance and Security Releases' );

These need to be separated into six separate strings using __().

/* translators: 1: WordPress version number. */
_n_noop( '<strong>Version %1$s</strong> addressed a security issue.',
         '<strong>Version %1$s</strong> addressed some security issues.' );

This string needs to be altered so a and some are replaced with a number placeholder.

In addition, the logic used in about.php in minor releases needs to be corrected so these strings are selected based on whether there is, for example, one maintenance release or multiple maintenance releases in the branch, rather than using _n().

Previously: #28502, #33239

Attachments (1)

34307.patch (1.3 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (7)

#1 @johnbillion
4 years ago

  • Milestone changed from Awaiting Review to 4.3.2

Milestoning for 4.3.2 as this bug only affects minor releases.

#2 @dd32
4 years ago

  • Milestone changed from 4.3.2 to 4.4

Bumping to 4.4 because we don't need to alter strings in a point release.

#3 @SergeyBiryukov
4 years ago

  • Keywords has-patch added; needs-patch removed

34307.patch decouples the strings. We should be careful to no longer use _n() for them in minor releases from now on.

I didn't touch them while working on #28502, because we know we're dealing with values less than 21 here, so this wasn't a problem for Slavic languages, but I agree we should be consistent with this.

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

#4 @ocean90
4 years ago

I don't think we have to announce the number of security issues on the about page. It would be incosistent with <strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug. anyway.

#5 @wonderboymusic
4 years ago

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

#6 @ocean90
4 years ago

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

In 35611:

About: Don't use _n_noop() for singular/plural strings which provide no placeholder for a number.

This allows for using proper plural forms in languages with more than two forms.

Props SergeyBiryukov.
Fixes #34307.
See #28502.

Note: See TracTickets for help on using tickets.