Make WordPress Core

Opened 4 months ago

Closed 2 months ago

#60975 closed enhancement (fixed)

URLs for the "An alt Decision Tree" page by language

Reported by: tmatsuur's profile tmatsuur Owned by: joedolson's profile joedolson
Milestone: 6.6 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch changes-requested commit
Focuses: accessibility Cc:

Description

The URL "https://www.w3.org/WAI/tutorials/images/decision-tree" appears to have pages in several languages at this time.

For example, "https://www.w3.org/WAI/tutorials/images/decision-tree/ja" is in Japanese.

Currently, this URL is not translated and is written directly in PHP and JavaScript files.

I believe it would be desirable to include this URL as a translation target and be able to change it to the URL corresponding to each language.

Attachments (2)

60975.2.diff (1.7 KB) - added by joedolson 2 months ago.
Patch that makes URL translatable.
60975.3.diff (1.7 KB) - added by joedolson 2 months ago.
Updated patch

Download all attachments as: .zip

Change History (19)

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


4 months ago

#2 @joedolson
4 months ago

  • Focuses accessibility added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.6
  • Owner set to joedolson
  • Status changed from new to accepted
  • Version 6.5 deleted

For long term support, we'll probably want to keep an index that maps the WAI's translation codes to our languages and use that for figuring out what to show. If we can encourage people from the polyglots team to contribute additional translations to the WAI so we can expand coverage, that would also be awesome.

Related: https://github.com/WordPress/Gutenberg/issues/19068

This ticket was mentioned in PR #6409 on WordPress/wordpress-develop by myhro.


3 months ago
#3

  • Keywords has-patch has-unit-tests added; needs-patch removed

Retrieves the W3C Web Accessibility Initiative (WAI) language code for a specified locale, allowing the external URL to be built with in the user language parameter when supported. Based on @joedolson's suggestion of keeping a map between WordPress locales and WAI language codes.

The function was added to /wp-includes/l10n.php, so it can be used from both /wp-admin/includes/media.php and /wp-includes/media-template.php. Unit tests were added as well.

It can be accessed in the WordPress Admin at:

  • Media Library, list mode: /wp-admin/post.php?post=[ID]&action=edit
  • Media Library, grid mode -> Image details modal: /wp-admin/upload.php?item=[ID]

Trac ticket: https://core.trac.wordpress.org/ticket/60975

---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

#4 follow-up: @oglekler
2 months ago

@joedolson can we just make the URL translatable without any complications? I believe that local translators should check if their language is available or there is some other appropriate language available and put in place the link.

#5 in reply to: ↑ 4 @SergeyBiryukov
2 months ago

Replying to oglekler:

can we just make the URL translatable without any complications? I believe that local translators should check if their language is available or there is some other appropriate language available and put in place the link.

Yes, I think introducing a dedicated function for this is probably an overkill at this point, and it does not seem to provide an easy way for translators to change the URL once a new localized version is available, as that would require a change in the core code.

Unless I'm missing something, just making the link translatable should be enough here.

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


2 months ago

#7 @joedolson
2 months ago

Well, that's an obvious solution that for some reason didn't occur to me.

I think we'll want to have a translator comment that points people to where to find translations (and maybe even guides people to where they can contribute W3C translations), but otherwise, yes - this seems like a sensible solution.

#8 @joedolson
2 months ago

Thanks for your work, @myhro, but having this be translatable will make it much, much easier to add new translations in the future as they come available. Otherwise, we'd need to commit an update in order to get new translations into the system.

#9 @myhro
2 months ago

Thanks for the feedback, @joedolson. Looks like making the link translatable is indeed way simpler.

@joedolson
2 months ago

Patch that makes URL translatable.

#10 @sabernhardt
2 months ago

  • Keywords changes-requested added; has-unit-tests removed
  • Type changed from feature request to enhancement
  1. The patch also will need to update the URL in wp-includes/media-template.php.
  2. The URL has a trailing slash now.
  3. I think the translator comment could benefit from mentioning the W3C Web Accessibility Initiative because that is the intended source.
  4. Once these two PHP changes are complete, it would be good to open a GitHub issue and/or pull request to update the Gutenberg links too.

@joedolson
2 months ago

Updated patch

#11 @joedolson
2 months ago

Related issue added in Gutenberg repository: https://github.com/WordPress/gutenberg/issues/62038

#12 @joedolson
2 months ago

I added a reference in the comment text to the W3C WAI initiative, although in all honesty if there is a good resource in a translator's language that isn't the W3C, that's probably better than an English-only resource that users can't learn from.

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


2 months ago

#14 @sabernhardt
2 months ago

Small edit: "Initiative" would need another i (which could be fixed when committing)

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 months ago

#16 @joedolson
2 months ago

  • Keywords commit added

#17 @joedolson
2 months ago

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

In 58240:

Media: Accessibility: Make alt text information URL translatable.

Allow translators to replace the W3C WAI decision tree link used to provide information about writing alt text. Improves accessibility for non-English speaking content authors.

Props tmatsuur, joedolson, oglekler, SergeyBiryukov, myhro, sabernhardt.
Fixes #60975.

Note: See TracTickets for help on using tickets.