This is a meta-issue for the integration of the concept of 'language of parts' in Drupal core. Language of parts is an accessibility requirement in WCAG and is meant to make language changes in texts detectable.
"3.1.2 Language of Parts: The human language of each passage or phrase in the content can be programmatically determined except for proper names, technical terms, words of indeterminate language, and words or phrases that have become part of the vernacular of the immediately surrounding text. (Level AA)" http://www.w3.org/TR/WCAG20/#meaning-other-lang-id
The recommended solution is to use the lang-attribute, for example:
<span lang="de">Ich bin ein Berliner</span> is a quotation from a speech by President John F. Kennedy.
This year in the Netherlands 45% of governmental websites fails on WCAG tests for this issue. Example: A governmental web page that should have language tags.
We discussed this in the last meeting in the accessibility group. As texts are provided in a lot of places, we suggested to break this issue into separate issues for the different levels and uses. First test and if needed file issues for the most common places like text fields.
General UI:
#1164682: links with a known language need language identifier
#1165476: if t() string has no translation or fallback language, text should have lang attribute
body field
The default Basic HTML format outputs the language attribute correctly and even transforms it to both xml:lang
and lang
. However, by default it is not possible to include span, p and div tags. That means that there is at the moment no option to include languages without additional visual markup (as cite, em, strong, blockquote etc).
#1322906: Allow span tag by default for language changes?
#1328768: attributes 'xml:lang' and 'xml:id' transform to 'lang' and 'id' in filter_xss
#1993928: Language of parts: Introduce a language toolbar button
#3174111: Automatically enable the language toolbar button on multilingual sites
text field
For text fields the default plain text format is not sufficient, an html filter should be included to output the language attribute.
#784672: Allow text field to enforce a specific text format
file field
Support language of parts for file description
#3163915: Support language of parts for file description
title field
Titles accept only plain text. There is no easy solution for this. Fix would be to have titles as text fields.
#1188394: Make title behave as a configurable, translatable field (again)
nodes/entities
#1164926: Nodes need to have languages specified separately for accessibility
#2036277: Language attribute is not attached to node title on a full page view
See also:
#1165466: Language of parts, accessibility and multilanguage: language button
#724128: Impossible to add "xml:lang" in a translatable field
discussion http://groups.drupal.org/node/145894
Comments
Comment #0.0
Hanno CreditAttribution: Hanno commentedissues added
Comment #1
Gábor HojtsyComment #1.0
Gábor Hojtsychanged duplicate issue of html in titles
Comment #1.1
Hanno CreditAttribution: Hanno commentedadding levels
Comment #1.2
Hanno CreditAttribution: Hanno commented53%>45%
Comment #1.3
Hanno CreditAttribution: Hanno commentedadded issue xml:lang
Comment #1.4
Hanno CreditAttribution: Hanno commentedadded info about filter formats
Comment #1.5
Hanno CreditAttribution: Hanno commented.
Comment #2
Gábor Hojtsy#1330922: Drupal 8 HTML 5 page template should use lang not xml:lang also opened.
Comment #3
Gábor HojtsyDismantling meta issues to clean up the D8MI issue list. (Working on a better overview for the issues).
Comment #4
Pancho@Gábor:
Is it okay to reopen and this issue?
We need to have an overview on what is needed to fulfill WCAG 2.0 Guideline 3.1.2. It seems to be one of the most trickiest aspects for AA conformance. Adding this on #2034915: [meta] Track progress in WCAG 2.0 conformance.
If you want we can remove the D8MI-meta tag.
Comment #4.0
Pancho.
Comment #4.1
PanchoAdded #1993928: Language of parts: Introduce a language toolbar button; moved #724128: Impossible to add "xml:lang" in a translatable field to "See also"; moved #1165476: if t() string has no translation or fallback language, text should have lang attribute to "General UI"
Comment #4.2
PanchoAdded #1368410: When viewing a node in another language as interface language, comment form should have correct language under a "Comments" heading
Comment #4.3
PanchoAdded #2036277: Language attribute is not attached to node title on a full page view to the "Nodes/entities" section
Comment #4.4
PanchoAdded #1164682: links with a known language need language identifier to General UI
Comment #5
Charles BelovAdded #2496223: Views containing content not in the page's language need to add tags which mark the language of parts
Comment #6
Charles BelovComment #10
mgiffordComment #14
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedCorrecting terminology in issue title. "Comply" doesn't appear anywhere in WCAG.
This plan is worth bumping. It identified lots of child issues, which haven't seen any progress.
I recently filed #3049122: Links in language switcher block do not conform to WCAG language-of-parts too.
Now that the Umami demo profile has content in two languages (with more being considered), we'll have an easier time trying out patches.
Comment #17
Charles BelovComment #18
Charles BelovComment #19
Charles BelovComment #21
mgiffordAdding link to #3174111: Automatically enable the language toolbar button on multilingual sites
Comment #27
Charles Belov"Filtered HTML format" in Drupal 7 is now called "Basic HTML format" in Drupal 10, if I am understanding this correctly. I have made this change to the Body section.