Skip to content

Official government website An official website of the Federal Government of Nigeria

How you know
Federal Ministry of Communications, Innovation & Digital Economy Nigerian Design Standards

Language switcher

Lets people read the site in the language they understand best. It sits at the right of the masthead pre-header and opens a short list of links to the same page in the other languages.

Updated

Live example

Language switcher
Controls
Property Control What it does
Default, open or focused
Size
28px trigger on desktop, 44px on mobile
The page’s language, in its own name

Overview

Use it on any NDS site that is published in more than one language. It belongs on the right of the masthead pre-header, on every page, so people find it before they have to read anything else.

Use the language switcher for

  • Moving to the same page in another language the site offers
  • Showing which language the page is in now
  • Every page of a site with two or more languages

Don’t use the language switcher for

  • A site that only has English (hide it)
  • Choosing a language for a form answer or download (use a select or radios)
  • A second switcher in the page body or footer

States

The trigger’s states. The menu uses the shared dropdown option states.

Default

No background: the globe, the current language and a caret.

Open

The background stays, the caret turns up and the menu opens below.

Specifications

The properties of the language switcher. The same in HTML and React. In WordPress, the theme adds it.

Language switcher properties
Property Type Possible values Description
current string
  • en · ha · ig · yo
The page’s language. The trigger shows it in its own name.
languages array
  • name + lang + href
Only the languages the site has: English first, then the rest in alphabetical order of their own names.
label string
  • any text
The accessible name of the nav. Defaults to “Language”.

In code: <nav aria-label="Language"> with a <button aria-expanded aria-controls> and a <ul> of links. Each link has lang and hreflang; the current one has aria-current="true". The globe and caret are aria-hidden.

Tokens

Language switcher tokens and contrast
Part Token Contrast on the page
Trigger text Label/medium · text/primary 17.6:1
Globe and caret (16px) icon/globe · icon/caret · size/icon/sm · text/primary 17.6:1
Hover and open surface/container behind the trigger, plus an underline on hover —
Focus ring border/focus with a 1px surface/canvas gap 4.5:1
Trigger size · corners 28px desktop, 44px mobile · spacing/050 to spacing/150 · radius/050 —
Menu Form/Dropdown menu: surface/canvas, 1px border/default, radius/100, 240px wide Border is decorative
Options Form/Dropdown option: Body/medium, 40px rows. Selected adds medium text and a check 17.6:1

Use cases

Don’t

Don’t use codes like EN or HA, or flags. They mean nothing to many readers.

Layout

Where the switcher sits and how much room it takes.

Right of the pre-header
On every page, on the right of the masthead pre-header, next to the contact details.
Desktop: 28px
At 768px and wider. The menu opens below, right-aligned to the trigger.
Mobile: 44px
Under 768px. It stays visible in the pre-header, not hidden in the menu.
Menu 240px
40px option rows on every screen, the same as the Text input dropdown.
One per site
Don’t add a second switcher in the page body or footer.

Copywriting

How to name and order the languages.

Own name

English, Hausa, Igbo, Yorùbá: each in its own language and spelling.

One line
No English translation underneath.
No flags or codes

A flag is a country, not a language. EN or HA mean nothing to many readers.

English first

Then the others in alphabetical order of their own names.

Only real languages

The list comes from the translation plugin. A site with only English hides the switcher.

Same order everywhere
On every page and every site.

Examples

Language switcher copywriting examples
Write Don’t write Why
Yorùbá Yoruba Its own name, with tone marks.
Hausa HA A code means nothing to many readers.
English UK flag and English Flags stand for countries, not languages.
Igbo Igbo language Just the name.
Language: English Change language The button’s accessible name says the current language.

Accessibility

The switcher is a button that opens a list of links, one per language.

Keyboard interaction for the language switcher
Key What it does
Tab Reaches the trigger. When open, moves through the language links; tabbing past the last link closes the menu.
Esc Closes the menu and returns focus to the trigger.
Enter or Space Opens and closes the menu. On a link, Enter goes to that language.
  • The button’s name says the current language, like “Language: English” (WCAG 4.1.2).
  • Every option has lang and hreflang; the current one has aria-current (WCAG 3.1.2).
  • The language only changes on Enter or a click, never by moving through the list (WCAG 3.2.2).
  • Trigger 28px on desktop and 44px on mobile; options 40px (WCAG 2.5.8).
  • Focus ring 4.5:1 and never hidden; text 17.6:1; Selected also shows a check and medium text (WCAG 2.4.7, 1.4.1).

For developers

Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.

For designers

Use Language switcher from 01 Library – Foundations. Pick the State and Size, and show only the languages the site has in the menu. Don’t detach it.

References

Feedback

Report a problem with this page