New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong usage of _n()
in WP 5.9 beta 3 translatable strings
#37471
Comments
The same applies to gutenberg/packages/editor/src/components/entities-saved-states/entity-type-list.js Lines 19 to 37 in 5604b23
|
Before making any changes to this behavior, please keep in mind that not all languages have the same concept of singular/plural as English. For example, there are languages where the plural for 2 is different than the plural for 3 and so on. |
I'm removing this issue from WP 5.9 project board since RC1 was released yesterday. Let's try and land a fix for this in a minor release. |
Maybe we can drop the label and description variations altogether. Instead, use singular form for labels and plural for descriptions. All other labels are in this form, making it consistent. @ockham, what do you think? |
Hey @Mamaduka, thanks for the ping! @aristath Your point about differentiating between plural forms is very valid and the reason why I used That said, I was a bit surprised here since I believed that @Mamaduka That could be an alternative; however, IIRC, I added the different versions for singular and plural in response to a designer's feedback that suggested doing so in order to make the copy correspond better to the number of changes (i.e. checkboxes) the user sees: |
Thanks for the feedback, @ockham. I think Re |
Description
This issue is copy pasted from https://core.trac.wordpress.org/ticket/54638.
Thanks @tobifjellner for the report.
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
Step-by-step reproduction instructions
gutenberg/packages/editor/src/components/entities-saved-states/entity-type-list.js
Lines 52 to 55 in 5604b23
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: