Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#60975 closed enhancement (fixed)

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

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

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 years ago.
Patch that makes URL translatable.
60975.3.diff​ (1.7 KB ) - added by joedolson 2 years ago.
Updated patch

Download all attachments as: .zip

Change History (20)

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


3 years ago

#2 @joedolson
3 years ago

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

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 years 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 years 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 years 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 years ago

#7 @joedolson
2 years 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 years 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 years ago

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

@joedolson
2 years ago

Patch that makes URL translatable.

#10 @sabernhardt
2 years ago

  • Keywords changes-requested added; has-unit-tests removed
  • Type feature request → 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 years ago

Updated patch

#11 @joedolson
2 years ago

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

#12 @joedolson
2 years 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 years ago

#14 @sabernhardt
2 years 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 years ago

#16 @joedolson
2 years ago

  • Keywords commit added

#17 @joedolson
2 years ago

  • Resolution → fixed
  • Status accepted → 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.

​@myhro commented on ​PR #6409:


2 years ago
#18

Closing this as [another approach will be used][1].

[1]: https://core.trac.wordpress.org/ticket/60975#comment:8

Note: See TracTickets for help on using tickets.