Make WordPress Core

Opened 7 weeks ago

Last modified 5 hours ago

#60975 accepted enhancement

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
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 (1)

60975.2.diff (1.7 KB) - added by joedolson 7 hours ago.
Patch that makes URL translatable.

Download all attachments as: .zip

Change History (11)

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


7 weeks ago

#2 @joedolson
7 weeks 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.


5 weeks 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
8 days 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
6 days 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.


5 days ago

#7 @joedolson
5 days 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
5 days 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
4 days ago

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

@joedolson
7 hours ago

Patch that makes URL translatable.

#10 @sabernhardt
5 hours 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.
Note: See TracTickets for help on using tickets.