WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.55k stars 4.22k forks source link

Language cannot be set on posts #15350

Open karlgroves opened 5 years ago

karlgroves commented 5 years ago

Language cannot be set on posts

Issue description

Posts written in languages other than the editor's own setting cannot have the correct language attributes defined.

Declaring the correct language of a page is vital, so that browsers can determine how to render the textual content, and assistive technologies can determine how it should be pronounced.

Issue Code
    <article id="post-19" class="...">...</article>

Remediation Guidance

Allow authors to set lang and dir attributes that apply to the whole post.

Recommended Code
    <article lang="es" id="post-19" class="...">...</article>

Relevant standards

Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-110 in Tenon's report

afercia commented 5 years ago

This is a very interesting point. Historically, for multi-language sites, WordPress relied on plugins that offer the ability to translate the whole page, including the post content.

To my knowledge, the need to have only the post content in a different language, while keeping the rest of a web page in the original language, hasn't been considered so often. This isn't new, as the Classic Editor doesn't provide any user interface to offer this ability.

However, I guess Gutenberg could add this feature, as in providing a way to add "meta" information to the post content. In this specific case, these meta info would be rendered as lang and dir attributes on the post content container.

StommePoes commented 5 years ago

Relatedly, language direction on pages or parts of page https://github.com/WordPress/gutenberg/issues/12352

kjellr commented 5 years ago

We discussed this in today's #design triage.

As noted in #15349, I think it'd be really interesting to dive into this holistically. It's clear from this and other issues that the experience for writers who use multiple languages is subpar, and it'd be great to focus in on that use case in its entirety. Seeing as this functionality didn't appear in the classic editor, I'm not sure if this would best be explored in a plugin or here, but it's worth exploring in any case. Adding the Needs Design tag to hopefully get that ball rolling.

enriquesanchez commented 4 years ago

Setting the post's lang attribute from the Document settings sidebar could look something like this:

Screen Shot 2019-12-18 at 15 06 12

This would set the post's lang attribute to <article lang="en-US"> and by default, it should be set to the site's language.

While I don't think this setting alone calls for a new accordion section in the sidebar, if we were to also implement the dir attribute, then it might be worth exploring a new accordion menu section.

See #15349 for a block-level exploration of this same setting.

mapk commented 4 years ago

As pointed out earlier, this use-case is normally handled through plugins. I wonder if we should leave this in the plugin territory?

The design to make this happen from @enriquesanchez looks fairly straightforward and may not require a lot of development if it's a setting that just appends a lang and dir.

cc @mtias and @youknowriad for additional thoughts.

swissspidy commented 4 years ago

Reminds me of https://github.com/glueckpress/wordpress-post-language.

IMO we should take a more holistic approach on this as part of Gutenberg phase 4 instead of just adding some setting field for post meta and later regret it because of backward compatibility.

mtias commented 4 years ago

Agreed about not rushing anything, even if it seems simple on the surface, and focus properly on the full problem in phase 4.

enriquesanchez commented 4 years ago

Alrighty then, closing for now and will wait for Phase 4's support for multilingual sites.

afercia commented 4 years ago

Not sure why this issue was closed, as the problem is yet to solve. I do realize improvements are planned for multilingual support in phase 4 but that doesn't seem a good reason to close a valid issue :)

Also, please do not close issues from the WPCampus accessibility audit if not solved. Keeping them open serves the purpose of keeping track of the progress on the audit. Thanks.

paaljoachim commented 4 years ago

I brought it up during a Gutenberg Design Triage. I see that nothing should be done here at the moment and approach it again when we begin to think about multilingual sites in phase 4.