Skip to content

wporg-plugins-2024: Link text to view all reviews is difficult to localize #481

Open
@t-hamano

Description

@t-hamano

There is a link to view all reviews in the sidebar of the theme/plugin page:

Image

This link is generated here:

return sprintf(
'<a href="%s">%s</a>',
esc_url( 'https://wordpress.org/support/plugin/' . $plugin_post->post_name . '/reviews/' ),
__( 'See all<span class="screen-reader-text"> reviews</span>', 'wporg-themes' )
);

The generated HTML is as follows:

<a href="">See all<span class="screen-reader-text"> reviews</span></a>

This sentence consists of the following words:

  • See: verb
  • All: adjective
  • Reviews: noun

The word reviews is invisible because of the CSS class for screen readers, so the visible sentence is See all, which consists of verb + adjective. In English, a sentence may be natural without a noun, but in other languages, this may not be the case.

In some languages, the sentence that represents verb + adjective may change if the noun is removed. Therefore, the current implementation makes it hard to provide a correct translated text for both the visible sentence and the sentence for screen readers. For this reason, I recommend not to hide a word from a sentence.

I recommend providing a consistent sentence "See all reviews", but if localization may cause conflicts with the "Add my review" text on the left, it may be good to add flex-wrap: wrap to the parent Group block.

P.S. We may be tempted to use the title attribute to solve this issue like the following example, but note that this is not recommended from an a11y perspective:

<a href="" title="See all reviews">See all</a>

Ref: https://make.wordpress.org/accessibility/handbook/best-practices/quick-start-guide/#links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions