Make WordPress Core

Opened 9 years ago

Closed 14 months ago

Last modified 13 months ago

#29748 closed enhancement (fixed)

Mark strings for screen readers

Reported by: pavelevap's profile pavelevap Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: I18N Keywords: good-first-bug has-patch commit has-dev-note
Focuses: accessibility Cc:

Description

Sometimes there are "hidden" strings which are for screen readers, but translators have to search for context to find the real meaning. Maybe we could mark all these strings somehow (comment for translators or context) to make it easier?

I can create patch if you think that it is a good idea (and we can also discuss best solution before: comment or context).

Attachments (5)

29748.patch (7.3 KB) - added by mercime 8 years ago.
First batch of translator comments for accessibility text
29748-2ndbatch.patch (70.8 KB) - added by mercime 8 years ago.
Second batch of translator comments for accessibility text
29748-wp-admin.patch (117.0 KB) - added by mercime 8 years ago.
wp-admin - refreshed translator comments
29748-wp-includes.patch (27.8 KB) - added by mercime 8 years ago.
wp-includes - refreshed translator comments
29748-wp-content.patch (31.4 KB) - added by mercime 8 years ago.
wp-content - refreshed translator comments

Download all attachments as: .zip

Change History (52)

#1 @boonebgorges
9 years ago

  • Version trunk deleted

#2 @SergeyBiryukov
8 years ago

A translator comment sounds like a good idea.

This ticket was mentioned in Slack in #core-i18n by swissspidy. View the logs.


8 years ago

#4 follow-up: @ocean90
8 years ago

  • Milestone changed from Awaiting Review to Future Release

A translator comment might be helpful, yes.

@swissspidy proposed that this should be added to the handbook (https://make.wordpress.org/core/handbook/best-practices/internationalization/) and considered for future strings. I tend to agree with that. Any suggestions for a comment?

#5 @Chouby
8 years ago

A translator comment looks more adapted than context for me. May be useful to add this to https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/ to extend the practice to plugins (the same for themes).

#6 in reply to: ↑ 4 ; follow-up: @swissspidy
8 years ago

Replying to ocean90:

A translator comment might be helpful, yes.

@swissspidy proposed that this should be added to the handbook (https://make.wordpress.org/core/handbook/best-practices/internationalization/) and considered for future strings. I tend to agree with that. Any suggestions for a comment?

What about simply using screen reader text or maybe only visible to screen readers? assistive text for screen readers?

#7 in reply to: ↑ 6 @ocean90
8 years ago

Replying to swissspidy:

What about simply using screen reader text or maybe only visible to screen readers? assistive text for screen readers?

We already have a few "accessibility text" comments for aria-label placeholders.

#8 @SergeyBiryukov
8 years ago

Related BuddyPress ticket: #BuddyPress6951

#9 @SergeyBiryukov
8 years ago

  • Keywords needs-patch added

@mercime
8 years ago

First batch of translator comments for accessibility text

#10 @mercime
8 years ago

  • Keywords has-patch added; needs-patch removed

#11 @netweb
8 years ago

  • Milestone changed from Future Release to 4.6

@mercime
8 years ago

Second batch of translator comments for accessibility text

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


8 years ago

#13 @chriscct7
8 years ago

  • Owner set to mercime
  • Status changed from new to assigned

This ticket was mentioned in Slack in #core by voldemortensen. View the logs.


8 years ago

@mercime
8 years ago

wp-admin - refreshed translator comments

@mercime
8 years ago

wp-includes - refreshed translator comments

@mercime
8 years ago

wp-content - refreshed translator comments

#15 @mercime
8 years ago

Refreshed patches are attached and re-organized as follows for your review:

This ticket was mentioned in Slack in #core by ocean90. View the logs.


8 years ago

#17 follow-up: @jipmoors
8 years ago

Just adding "accessibility text" doesn't really complete clarifying the context for the strings. Especially for "Page" which I saw as a pagination use.

#18 in reply to: ↑ 17 @afercia
8 years ago

Replying to jipmoors:

Just adding "accessibility text" doesn't really complete clarifying the context for the strings. Especially for "Page" which I saw as a pagination use.

Yep maybe the text could be improved a bit. What translators really need to know? I'd say:

  1. it's hidden text, not visible in the UI so better they don't waste time trying to find the place where this text is displayed because... well, it is not displayed at all
  2. it is used to expand short labels and sentences to give more context or add feedback where otherwise the feedback is only visual

Anyone able to summarise all this in a very short sentence? :)

#19 @ocean90
8 years ago

  • Keywords needs-refresh added
  • Milestone changed from 4.6 to Future Release

#20 follow-up: @afercia
8 years ago

Strings used to expand UI controls text and strings used for wp.a11y.speak() messages are a bit different in their scope, but I'd rather keep things simple and use something like hidden accessibility text. Any thoughts welcome!

#21 in reply to: ↑ 20 @SergeyBiryukov
8 years ago

Replying to afercia:

I'd rather keep things simple and use something like hidden accessibility text.

Seems good to me.

#22 @desrosj
16 months ago

  • Keywords good-first-bug added
  • Milestone set to 6.2

Found this one going through tickets without milestones.

It seems like hidden accessibility text was the preferred description that was landed on, but this was never added to the i18n handbook.

There are currently 21 occurrences of translators: accessibility text in trunk, all in JS files. These instances are also a bit more verbose, such as accessibility text for the widgets screen top bar landmark region and accessibility text for the footer landmark region.

The patches attached here also need to be refreshed. A GitHub pull request would probably be best to manage these.

#23 @sabernhardt
14 months ago

  • Focuses accessibility added

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.


14 months ago

This ticket was mentioned in Slack in #core by costdev. View the logs.


14 months ago

This ticket was mentioned in PR #3970 on WordPress/wordpress-develop by @kebbet.


14 months ago
#26

  • Keywords needs-refresh removed

Trac ticket:

#27 @kebbet
14 months ago

  • Keywords needs-refresh added

Added a WIP-pr to the ticket.

#28 @kebbet
14 months ago

In linked PR: All screen reader strings in wp-admin have an added comment on its visibility. The ones which has a placeholder are constructed like this:
/* translators: hidden accessibility text. %s: Theme name */

#29 @kebbet
14 months ago

  • Keywords needs-refresh removed

Linked PR at GitHub is ready for review, only 132 files touched. And only PHP-files.

I kept some existing translation comments like
/* translators: Only visible to screen readers */

And I went with this comment everywhere else:
/* translators: hidden accessibility text */

This ticket was mentioned in Slack in #accessibility by kebbet. View the logs.


14 months ago

@SergeyBiryukov commented on PR #3970:


14 months ago
#31

Thanks for the PR!

Pretty much all of the comments in core are capitalized and end with a period, so let's do the same here:

/* translators: Hidden accessibility text. */

There are also these comments previously used for the same purpose (32 matches in 16 files)

/* translators: Accessibility text. */

Let's change them to use new wording too, for consistency.

@kebbet commented on PR #3970:


14 months ago
#32

Thanks for the PR!

Pretty much all of the comments in core are capitalized and end with a period, so let's do the same here:

/* translators: Hidden accessibility text. */

There are also these comments previously used for the same purpose (32 matches in 16 files)

/* translators: Accessibility text. */

Let's change them to use new wording too, for consistency.

Thank you for the review. I will adjust the PR later tonight.

@kebbet commented on PR #3970:


14 months ago
#33

@SergeyBiryukov pr updated in response to your comment. Maybe ready for final review and commit?

#34 @costdev
14 months ago

  • Keywords commit added

I've reviewed PR 3970 and aside from a tiny mistake in one instance that can be updated during commit See here, the rest looks ready for commit consideration.

#35 @kebbet
14 months ago

The mistake has been fixed, thanks for reviewing @costdev !

#36 @costdev
14 months ago

Thanks @kebbet! The PR looks good to me! 🙂

#37 @kebbet
14 months ago

The ticket owner has not been active for years, could someone else take ownership and get this commited before 6.2 beta1?

@costdev @audrasjb @SergeyBiryukov

#38 @SergeyBiryukov
14 months ago

  • Owner changed from mercime to SergeyBiryukov
  • Status changed from assigned to reviewing

#39 @audrasjb
14 months ago

I checked the changeset and it looks good to ship with 6.2 on my side!
Let's commit this before beta 1.

#40 @audrasjb
14 months ago

Oh just noticed that Sergey took ownership. Perfect! 🙏

#41 @SergeyBiryukov
14 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55276:

I18N: Mark screen reader strings as such with translator comments.

This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.

Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.

@SergeyBiryukov commented on PR #3970:


14 months ago
#42

Thanks for the PR!

I have found a few misaligned closing tags and tried to correct them on commit, also made some minor formatting edits for consistency. Looks great to me otherwise 🙂

Merged in r55276.

This ticket was mentioned in Slack in #core by sergey. View the logs.


13 months ago

#44 @milana_cap
13 months ago

  • Keywords add-to-field-guide added

#45 @swissspidy
13 months ago

  • Keywords has-dev-note added; add-to-field-guide removed

This will be added to the dedicated i18n dev note

#46 @SergeyBiryukov
13 months ago

In 55422:

Twenty Seventeen: Mark one more screen reader string with a translator comment.

Includes minor comment layout fixes for consistency with other themes.

Follow-up to [55276].

See #29748.

Note: See TracTickets for help on using tickets.