Skip to content

Conversation

badembafr
Copy link

Fix localization of "See all reviews" link by removing hidden screen-reader text

Hello all,

This pull request addresses the issue described here:
#481

What I changed :
I replaced the original translation string:

__( 'See all<span class="screen-reader-text"> reviews</span>', 'wporg-themes' )

with:

__( 'See all reviews', 'wporg-themes' )

Why this change is necessary :
This improves localization and accessibility.
In French for example, the previous string would result in something like:

"Voir tous les"

Which is incomplete and incorrect, because "reviews" was hidden using the screen-reader-text class.
After this change, the sentence becomes:

"Voir tous les avis"

Which is grammatically correct and understandable for all users.

Note:
I'm not sure whether you would also recommend adding flex-wrap: wrap on the parent container to prevent layout issues on smaller screens. Let me know if you'd like me to add that as well.

Thanks in advance !

@dd32
Copy link
Member

dd32 commented May 26, 2025

This PR changes the link display for all users, where as I believe the string is in it's current state because it was requested to be shorter for design purposes (while the reviews additional was added for accessibility purposes).

I'm in support of changing this though, perhaps to a screen reader vs visual representation through something like:

<span aria-hidden="true">See all</span>
<span class="screen-reader-text">See all reviews</span>

(Both internal strings would be translated without the )
That could be done through two replacements:

sprintf(
'<a href="%s">%s%s</a>',
...,
'<span aria-hidden="true">' . __()....,
'<span class="screen-reader-text">' . __()....,
)

@badembafr
Copy link
Author

Ok I will try to fix this problem.

Thanks !

@t-hamano
Copy link

Thanks for the PR.

perhaps to a screen reader vs visual representation through something like

This certainly seems like the best approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants