Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#54638 closed defect (bug) (reported-upstream)

Incorrect use of _n() in new strings for 5.9

Reported by: tobifjellner's profile tobifjellner Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9
Component: Editor Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The new code for WordPress contains three instances where the "Template Part"/"Template Parts" string pair is used.

However, this is usage of _n() is incorrect.
If you want to handle just the singular and plural terms, then this should be handled in the code (if 1 == n then ...) and not by using _n()

Alternatively, if these strings are used together with the relevant number, then a placeholder for the count variable should be present in the string (i.e. printf)

Three references (to the current as-built package)
https://build.trac.wordpress.org/browser/trunk/wp-includes/js/dist/editor.js?marks=5220#L5220

const entityLabel = name === 'wp_template_part' ? Object(external_wp_i18n_["_n"])('Template Part', 'Template Parts', list.length) : entity.label; // Set description based on type of entity.

https://build.trac.wordpress.org/browser/trunk/wp-includes/js/dist/block-library.js?marks=38830#L38830

https://build.trac.wordpress.org/browser/trunk/wp-includes/js/dist/editor.js?marks=5220#L5220

Change History (6)

This ticket was mentioned in Slack in #polyglots by tobifjellner. View the logs.


3 years ago

#3 @audrasjb
3 years ago

  • Milestone changed from Awaiting Review to 5.9
  • Severity changed from major to normal

Thanks @tobifjellner for spotting this!
Reported upstream on Gutenberg: https://github.com/WordPress/gutenberg/issues/37471

Moving to 5.9, waiting for an upstream resolution.

#4 @SergeyBiryukov
3 years ago

  • Description modified (diff)

#5 @ocean90
3 years ago

  • Milestone 5.9 deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Closing as reported-upstream after moving the issue to the WordPress 5.9 Must-Haves project.

This ticket was mentioned in Slack in #polyglots by nao. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.