30 lines
772 B
Plaintext
30 lines
772 B
Plaintext
HTML documents should have a valid IETF's BCP 47 `lang` attribute.
|
|
|
|
== Why is this an issue?
|
|
|
|
Screen readers require a specified language to function correctly. Without it, they default to the user's set language, causing issues for multilingual users. Specifying a valid language ensures correct pronunciation and a less confusing experience.
|
|
|
|
== How to fix it
|
|
|
|
Add a `lang` attribute with a valid IETF BCP 47 value.
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,html,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
<html></html>
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,html,diff-id=1,diff-type=compliant]
|
|
----
|
|
<html lang="en"></html>
|
|
----
|
|
|
|
== Resources
|
|
=== Documentation
|
|
* W3C, https://www.w3.org/International/articles/language-tags/[Language tags in HTML and XML]
|