liveBook · Manning

Language selector

As explained in Architecting Accessibility

A language selector is an interface control that lets users choose the language in which a site or page is presented.

A language selector helps visitors reach a localized page. Use a labeled navigation landmark with links named in each language’s native form; identify the current page both visually and with aria-current="page". section 4.2

<nav aria-label="Language Selector">
   <ul class="lang-selector">
     <li>
       <a href="../en/index.html" 
         hreflang="en" 
         lang="en" 
         aria-current="page">English</a>
     </li>
     <li>
       <a href="../es/index.html"
         hreflang="es" 
         lang="es">Español</a>
     </li>
     <li>
       <a href="../fr/index.html" 
         hreflang="fr" 
          lang="fr">Français</a>
     </li>
   </ul>
</nav>

Example markup links to English, Spanish, and French pages, with lang and hreflang on each link. section 4.2

How Architecting Accessibility covers it

How deep it goes
Demonstrates accessible link markup and active-page cues, with an example spanning three languages.
Examples
Uses English, Spanish, and French links labeled in their native forms, with the current language marked.
What it assumes
Assumes a multilingual site with translated pages and introduces language tags for identifying page and link text.
What you can do after
Build an accessible language selector with semantic navigation and links to localized pages.
How it connects
Connects language selectors to the lang attribute, BCP 47 language tags, hreflang, and aria-current.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.