Making WordPress.org

Opened 4 years ago

Closed 4 years ago

#3446 closed defect (fixed)

Incorrect use of _n() in /plugins/plugin-directory/widgets/class-meta.php

Reported by: tobifjellner Owned by: SergeyBiryukov
Milestone: Priority: normal
Component: Plugin Directory Keywords:


Incorrect use of _n() at https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php?marks=91#L91

echo esc_html( _n( 'Language:', 'Languages:', $available_languages_count, 'wporg-plugins' ) );

_n() should be used only when the steering number is included in the translated string.
Otherwise, for instance, Russian would put singular if there happen to be 21 languages available.

Solution: Either just a plain string "Number of languages:", or use printf() to inject the number itself: 'There is %d language'/'There are %d languages'

Change History (1)

#1 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 6595:

Plugin Directory: Don't use _n() for a string without a placeholder.

Props tobifjellner.
Fixes #3446.

Note: See TracTickets for help on using tickets.