Picto thématique

Rule n° 125 - Each page’s source code indicates the content’s main language.

A web page is written in a language that is not necessarily identifiable by the tools that analyse the pages. This information must be introduced to all automatic tools by the source code of the pages.

#Accessibility #SEO #Internationalization #Development


  • Cultivate content indexing by language.
  • Facilitate machine translation.
  • Enable correct reading of the content by a synthesized speech tool.
  • Improve the accessibility of content for people with disabilities.
  • Improve the way content is taken into account by search engines and indexing tools.


Fill in the lang attribute of the html root element using the appropriate language code (as indicated in the registry maintained by IANA: http://www.iana.org/assignments/language-subtag-registry). In practice, for French this is: <html lang="fr"> (in HTML) et <html lang="fr" xml:lang="fr"> (in XHTML).

Otherwise, in more complex cases, the content language can be indicated by the different parent elements: head, body, title, etc.

Find out more:


Verification consists in checking that the lang attribute of the html element is present and relevant (or failing that check its descendant elements) in the source code. In the source code of each page:

  • Check that the default language of the content is indicated by the lang attribute of the html element, for example <html lang="fr"> (in HTML)
  • If not, check for each content element that is is at least inherited form a parent element (head, body, title, etc.) from its langattribute.

Check the validity and relevance of the language code used. For this, use for example the Language Subtag Lookup Tool by Richard Ishida, https://r12a.github.io/app-subtags/.

Common cases of incorrect language codes include jp instead of ja for Japanese, lu instead of lb for Luxembourgish, gr instead of el for Greek, lat instead of la for Latin, and oci instead of oc for Occitan. Additionally, the codes mul for "multiple languages" and und for "undetermined language" must not be used in web content. Finally, the xml:lang can also be entered in addition to the lang attribute, but it is not sufficient to comply with this best practice.

By Opquast - Read the license

Overview and background

The 240 Opquast rules are defined and agreed upon by an extensive community of web professionals and academics. These web quality assurance guidance rules started as a list of best practices 20 years ago. They have since been revised every five years and have been tried and tested via millions of web interactions by Opquast community’s customers, including the leading CMS communities which have developed plugins for WordPress, Drupal and Prestashop. The most recent version, v4, was established in 2020.

Each rule has individual technical sheets and the rules can be searched by project phase or various topics: e-commerce, data-privacy, internationalization, security, code, etc, or by themes: accessibility, SEO, mobile, privacy, and ecodesign. The complete checklist is available on a creative commons license BY-SA.

To learn more about the Opquast approach, read this article published at Smashing Magazine

Broad application and benefits

The rules should be applied to your projects from the design phase through to post-implementation , and they should be understood by all professionals with web and customer experience (CX) responsibilities: from strategy to operations, marketers to project managers, and editorial to technical staff. The benefits of using this ruleset are numerous, including improving customer satisfaction, web performance, and e-commerce, and expanding your client base, while also decreasing your errors and costs.

Multidisciplinary verticles - accessiiblity, SEO, e-commerce, ecodesign etc..- starting from the foundational Opquast base.

Discover Opquast training and certification

The objective of these rules and the Opquast community mission is ‘making the web better’ for your customers and for everyone! Opquast rules cover the key major areas of risk that can negatively affect website users such as privacy, ecodesign, accessibility and security.

Opquast training has already allowed over 17,000 web professionals to have their skills certified. Train your teams, contact us

We offer a 1 hour free discovery module.