Description
Description
Splitting this out from #56381 (comment)
WordPress best practices for localization strongly recommend to avoid translatable strings that concatenate or contain variables, because the variable may differ in gender and number in languages other than English. In these cases it would be impossible to correctly translate the string.
There are several cases in the Gutenberg codebase where this recommendation is not followed. One of these cases is in the 'post publish pane':
gutenberg/packages/editor/src/components/post-publish-panel/postpublish.js
Lines 128 to 132 in 40c233f
The above string can't be translated correctly. The placeholder gets replaced with the post type, which can vary in gender.
While in English 'Post address', 'Page address' or 'Product address' etc. are perfectly okay, in ohter languages translators would need to:
- Use an appropriate gender form, for example in Italian:
Indirizzo dell'articolo
Indirizzo della pagina
- Change the order of the words in the string but they can't do it if they don't know what
%s
will be replaced with.
These string should:
- Either use a post type label (a new one to be added in Core) as done for viewPostLabel and addNewPostLabel.
- Be changed to a simpler string, also for consistency as explained in Update URL popover #56381 (comment) for example
Permalink
.
Right now thie can't be translated correctly and we can't blame translators for this. Given this string:
__( '%s address' ),
translators can only translate address
and hope that it will rok in all cases. Unfortunately, it doesn't worl
The same problem occurs when concatenating text. Concatenation should always be avoided. This is not translatable corrrectly:
because in many languages the adjectives published
and scheduled
vary in gender depending whether the post type name is male or female.
Screenshots comparing Post / Page panels in English and Italian:
Step-by-step reproduction instructions
- Switch the WordPress admin to a language with gender forms e.g. Italian.
- Publish a post or page.
- In the post-publish panel, observe the strings mentioned above in the issue description can't be translated correctly.
Screenshots, screen recording, code snippet
No response
Environment info
No response
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
Activity