#54638 closed defect (bug) (reported-upstream)
Incorrect use of _n() in new strings for 5.9
Reported by: | tobifjellner | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.9 |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
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/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
@
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.
#5
@
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.
Not exactly sure if this helps but the code seems to come from this line: https://github.com/WordPress/gutenberg/blob/trunk/packages/editor/src/components/entities-saved-states/entity-type-list.js#L54