-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Prevent broken translations in some locales for the edit post link #1066
Prevent broken translations in some locales for the edit post link #1066
Conversation
…use of screen reader text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise 👍
esc_html__( 'Edit %s', '_s' ), | ||
the_title( '<span class="screen-reader-text">"', '"</span>', false ) | ||
/* translators: %s: Name of current post. Only visible to screen readers */ | ||
__( 'Edit <span class="screen-reader-text">%s</span>', '_s' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously the function was esc_html__()
. It is best not to change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's won't work now that we have the html back in the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, then we will need to use wp_kses()
like done here: https://github.com/Automattic/_s/blob/master/inc/template-tags.php#L65
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could have been fixed by just adjusting the translators comment to be more clear, rather than changing the actual code.
My first instinct was to do just that - but that means (for Hebrew) choosing to omit a word from the screen reader version. It is not a better outcome. |
Tweak Automattic#1066 to fix build errors Adjust location of placeholder text
Fix build errors related to #1066
* upstream/master: (31 commits) Improve "Continue reading" word order for i18n Create readme.txt Remove invalid rel="designer" attribute Fix build errors related to Automattic#1066 Adjust location of placeholder text Tweak Automattic#1066 to fix build errors Fix build errors related to Automattic#1066 Remove tags Update README.md to be consistent with new file name Replace extras.php with template-functions.php Update WordPress version and copyright date Switch versions of PHP Code Sniffer for build process Adding ID to comment labels for post CS: Fix code layout of nested function calls with associative arrays. I18n: ensure all text strings with placeholders have translators comments. Code obfuscation: Fix assignment within a condition I18n: Fix a translation call for a text string which needs context Update readme.txt doctype uppercase to lowercase clarify who maintains _s and standardize returns in CONTRIBUTING.md ... # Conflicts: # languages/_s.pot
* Update copyright year. * Add comments for translators. * Translation fix for a comment strings * Added translation word by code change. see Automattic#1100, Automattic#1066 Automattic#1117
Since #775, the translation of the edit post link in some languages can end up forming a partial sentence.
By default, in English, the visual output is the word "Edit".
In Hebrew for example, the translation would be a single word:
With the addition of the post title, the translator is instructed to translate
Edit %s
with%s
being the post name. In Hebrew, the translation will beNote the added word
את
To quote from this post:
The end visual result in Hebrew would be:
Which is weird. Think of it as "Edit The" (without the actual object).
This PR fixes that by expanding the comment to note that the post name only visible to screen readers, and puts the screen reader span html inside the translated string.
The translator for Hebrew can now do something like
לערוך <span class="screen-reader-text">את %s</span>
, putting the את word inside the invisible span.