Help › Languages

The language switcher

Partly builtLast updated

On this page

The switcher is the control your visitors use to pick a language.

Where it comes from#

How it behaves#

Options#

Every option is optional and has a safe default. On the Install page of your site, the Language switcher section has a form with a live preview and writes the code line for you. On a plain page they are attributes of <rl-switcher>; on the one-line script tag they are the same words with a data- prefix.

OptionChoices (default first)
layoutdropdown, list (links side by side), buttons (pills)
namesnative (Français), english (French), code (FR), both (Français (French))
flagsnone, on (flag next to the name), only (flag, name kept for screen readers)
currenton, off (hide the current language)
originalon, off (leave out the language the site was written in)
placementinline (in your menu, header or footer), floating (corner)
positionend, start (follows the page direction, so it mirrors in right-to-left pages)
sizenormal, compact, large
schemelight, auto (follows the visitor's light or dark setting), dark, inherit (your site's text colour)
shaperounded, square
attributionnone, or a short "Translated by" line (empty value = the default text)

About flags. A flag is a country, not a language. Many languages are spoken in several countries, and some visitors feel excluded or misrepresented, so flags are off by default. Screen readers skip the flag and read the language name. Some Windows browsers show two letters instead of a flag. The flag comes from the language code (pt-BR shows Brazil) or, for a bare code such as en, from the browser's likely region (en shows the United States): verify this suits your audience, or leave flags off.

No jumping. An inline switcher keeps its place in your page while the languages load (a few pixels of difference at most), and a floating one never moves the page.

Browser language suggestion#

You can turn on a suggestion banner. It offers the visitor's browser language. It never switches the page by itself, and it never redirects. Dismissing it is remembered for that tab only.

Styling#

You can set colours, radius, font and focus colour with CSS variables: --rl-bg, --rl-fg, --rl-border, --rl-accent, --rl-radius, --rl-font, --rl-font-size, --rl-focus and --rl-z.

Two placements exist: inline in the page, or floating at the start or end of the screen. On narrow screens the floating switcher spans the bottom.

What is tested#

It has automated accessibility checks in Chrome. It has not been tested in other browsers or with real screen readers: verify.

The visitor's choice#

The choice is stored in the visitor's browser so the next visit starts in the same language. See What visitors' browsers store.