[wp-trac] [WordPress Trac] #54638: Incorrect use of _n() in new strings for 5.9
WordPress Trac
noreply at wordpress.org
Fri Dec 17 00:49:56 UTC 2021
#54638: Incorrect use of _n() in new strings for 5.9
--------------------------+---------------------
Reporter: tobifjellner | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.9
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+---------------------
Description changed by SergeyBiryukov:
Old description:
> 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
New description:
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
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54638#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list