HTML language tags and accessibility
This page is for site builders and administrators. Screen readers choose their pronunciation from the lang of the
page and of its parts; search engines and browsers use it too. WCAG 2.2 asks for the
language of the page (3.1.1) and of passages in another language (3.1.2).
Contents
Where the tag comes from
Page layouts print eZLocale::httpLocaleCode(), which is [HTTP] ContentLanguage of the siteaccess's locale file.
Since 6.0.15 every shipped locale names a valid BCP 47 tag (fr-FR, nb-NO, he-IL), replacing earlier non-standard
values such as no-bokmaal (Translations and languages, HTML language tags).
Internal locale codes (fre-FR) are not BCP 47; only the HTTP tag is
(Internationalization standards).
The page language
In your public pagelayout:
<html lang="{$site.http_equiv.Content-language|wash}"{if eq( first_set( $site.text_direction, 'ltr' ), 'rtl' )} dir="rtl"{/if}>The administration's pagelayouts already do this (Accessibility standards).
Parts in another language
- Content shown in another language than the page (a fallback translation, a quote): wrap it in an element with
its own
lang; for right-to-left contentdesign/standard/templates/parts/exp_content_direction.tplprintslang="..." dir="rtl". - The language switcher: each link carries the
langof its language (see "The language switcher"). - Phrases inside rich text: editors can mark a passage's language only if your rich text setup offers a way to do so; check the editor configuration of your site before promising it to editors.
What is and is not audited
Accessibility standards states the project's status: WCAG 2.2 level AA Partly complies for the admin4 and admin4l administration; public site designs and the online editor are not audited; EN 301 549 and Section 508 are Unverified; no VPAT or Accessibility Conformance Report exists. Your public design's conformance is yours to test (Testing accessibility).
Checks
- To do: Every language siteaccess prints the right
langon<html>. - To do: Fallback content carries its own
lang. - To do: Switcher links carry
lang. - To do: A screen reader test of one page per language.
- To do:
hreflanglinks, if you add them, use the same tags.
Related pages
- Accessibility standards
- Accessibility for site builders
- Right-to-left languages on public sites
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.