Skip to content
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

Post publish panel: Simplify design and follow best practices for localization #56854

Open
afercia opened this issue Dec 7, 2023 · 4 comments
Assignees
Labels
l10n Localization and translations best practices Needs Design Feedback Needs general design feedback. [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Dec 7, 2023

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':

label={ sprintf(
/* translators: %s: post type singular name */
__( '%s address' ),
postLabel
) }

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:

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:

https://github.com/WordPress/gutenberg/blob/trunk/packages/editor/src/components/post-publish-panel/postpublish.js/#L114-L117

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:

Screenshot 2023-12-07 at 10 49 33

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

@afercia afercia added [Type] Bug An existing feature does not function as intended [Package] Editor /packages/editor l10n Localization and translations best practices labels Dec 7, 2023
@afercia afercia self-assigned this Dec 7, 2023
@SergeyBiryukov
Copy link
Member

Related: #28990

@afercia
Copy link
Contributor Author

afercia commented Dec 12, 2023

Thinking at this a little more in depth, I think including the linked post title in the 'published' or 'scheduled' string does or harms than good.

When publishing or scheduling a post, the most important information I'd like to have as a used is some feedback that confirms the post has been publishedor scheduled successfully. As a used, I would benefit from that information to be prominent in the post-publish panel. Instead, what I get is the linked post title in great prominence. The 'is now live' and 'is now scheduled' parts of the string are visually less prominent and not that readable. This i smore evident when the post title is long and goes in two lines. Screenshot to illustrate:

Screenshot 2023-12-12 at 09 23 15

I'd argue this isn't idea. While I understand some of the reasoning behind thie implementation, I think a clear, short, message that just informs me the publishing / scheduling was successful would be better. Im not sure the post title should be there in the first place. Also, making the post title a link seems redundant and just clutter the UI as there's a well visible 'View Post' button in the panel.

@afercia
Copy link
Contributor Author

afercia commented Dec 12, 2023

One more case: concatenating a string with a variable (in this case a component that renders different date and time in different format) is not translatable correctly:

{ __( 'is now scheduled. It will go live on' ) }{ ' ' }
<PostScheduleLabel />.

For example, when scheduling a post to be published today at a later time, PostScheduleLabel renders the word Today. I'm not sure on Today is correct English:

Screenshot 2023-12-12 at 14 37 27

More importantly, in other languages, on would need to be changed to something else or entirely omitted depending whether PostScheduleLabel renders a date or a word like Today. In Italian, for example, il 7 settembre is correct but il Oggi is totally wrong:

Screenshot 2023-12-12 at 14 36 15

Also, in languages other than English on may need to be changed to something else depending on the day number. for example, in Italian:

  • il 2 dicembre is correct.
  • il 8 dicembre is wrong. As 8 is pronounced otto and starts with a vocal, the article il is incorrect. It should be: l'8 dicembre.
  • il 11 dicembre is wrong as well, for the same reason.

@afercia
Copy link
Contributor Author

afercia commented Feb 21, 2024

After various attempts, I realized that it's not possible to fix the translatable strings without introducing design changes. As such, I'd like to broaden the scope of this issue to propose a new, simpler, clearer, design of the publish panel. I'll update this issue title accordingly.

@afercia afercia added the Needs Design Feedback Needs general design feedback. label Feb 21, 2024
@afercia afercia changed the title Post publish panel: Follow best practices for localization Post publish panel: Simplify design and follow best practices for localization Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l10n Localization and translations best practices Needs Design Feedback Needs general design feedback. [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants