All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.web.rules.Web.S5254.html Maven / Gradle / Ivy

The newest version!

Why is this an issue?

The <html> element should provide the lang and/or xml:lang attribute in order to identify the default language of a document.

It enables assistive technologies, such as screen readers, to provide a comfortable reading experience by adapting the pronunciation and accent to the language. It also helps braille translation software, telling it to switch the control codes for accented characters for instance.

Other benefits of marking the language include assisting user agents in providing dictionary definitions or helping users benefit from translation tools.

Both the lang and the xml:lang attributes can take only one value.

 

Noncompliant code example

<!DOCTYPE html>
<html> <!-- Noncompliant -->
    <head>
          <title>A page written in english</title>
          <meta content="text/html; charset=utf-8" />
    </head>  


    <body>     
    ...   
    </body>
</html>

Compliant solution

<!DOCTYPE html>
<html lang="en">
    <head>
          <title>A page written in english</title>
          <meta content="text/html; charset=utf-8" />
    </head>  


    <body>     
    ...   
    </body>
</html>
<!DOCTYPE html>
<html lang="en" xml:lang="en">
    <head>
          <title>A page written in english</title>
          <meta content="text/html; charset=utf-8" />
    </head>  


    <body>     
    ...   
    </body>
</html>

Resources





© 2015 - 2025 Weber Informatics LLC | Privacy Policy