Language switcher
Each language entry leads to the same page in that language, or to that language's home page when the page is not translated. The switcher shows only once the translations are shown on the site (Show the translated pages on the site).
The block and the shortcode
- Block: Language switcher, in the Theme category. Place it in your header (site editor: Appearance → Editor → Patterns → Header), a menu, a footer or a sidebar.
- Shortcode:
[lrob_ai_translator_switcher], for themes and builders without blocks. It acceptsdisplayandform:[lrob_ai_translator_switcher display="flag_code" form="dropdown"].
Settings → Display tells you where a switcher is already placed (header, menus, widgets, synced patterns).
How it reads
Set for the whole site in Settings → Display, with a live preview, or block by block in the block's sidebar:
display |
Shows |
|---|---|
name |
English |
flag_name |
🇬🇧 English |
flag_code |
🇬🇧 EN |
flag |
🇬🇧 (the name for screen readers and as a tooltip) |
code |
EN |
name_code |
English (EN) |
form |
|
|---|---|
inline |
A line of links. |
dropdown |
A menu that opens on hover or click, works with the arrow keys, Home, End and Escape, and works without JavaScript. |
Flags are drawn by the plugin, light, and the same on every system. A language's flag can be changed, or removed, in Settings → Languages.
The switcher takes the colours of the place it is in: the text colour around it, and for the drop-down, the background of its container, in light and dark modes of your theme.
The floating switcher
Settings → Display → Floating switcher (off by default): a drop-down switcher in a corner of every page, in addition to the ones you placed.
- Corner: bottom right, bottom left, top right or top left. Its menu opens towards the inside of the page.
- From the side and From the top or bottom (px, 16 by default): move it away from another floating button, such as a chat or a "back to top" button.
- It takes the background and the text colour of the page, is smaller on phones (the flag alone when there is one), and is usable with the keyboard.
Coming from TranslatePress
Once TranslatePress is deactivated, its language switcher block and its [language-switcher] shortcode keep working: they show this plugin's switcher.