Documentation

Language switcher

The switcher is what lets visitors change language. It is configured in Translations → Switcher. It only appears when there is at least one target language.

Mode (Where it appears)

ModeWhat it does
Automatic (default)Appears on its own, floating, without touching the theme. Pick the corner in Position: bottom right, bottom left, top right or top left.
ManualPlace it wherever you want, with the shortcode or the PHP function (see below).
OffIt does not appear.

In automatic mode, if you place a switcher by hand on a page, the floating one leaves that page — there are never two.

The floating switcher also appears in the cart and the checkout. Someone who reaches the cart in the wrong language needs a way back to theirs, precisely when they are spending money.

Shape

Each shape is previewed in the panel with your site’s languages.

ShapeWhen to use it
ListSide by side, everything visible. Scrolls horizontally on its own if it does not fit.
ColumnOne per line. For footers and narrow sidebars.
MenuOpens with a click. Takes the space of a single language.
System boxThe system’s select box. On phones it opens the native wheel, easier to hit with a finger.

How it reads

  • Flags — show an emoji flag before the name. They are drawn by the viewer’s system, with no images. A language whose code includes no country (e.g. fr instead of fr_FR) gets no flag — a country is not a language.
  • Name or codeEnglish, Español or EN, ES.
  • Suggest the language of the visitor — see The language suggestion bar.

Appearance

With a live preview alongside:

  • Box — background, border, border on hover.
  • Languages — text, background and text on hover, background and text of the current language.
  • Shape — text size, rounded corners, shadow.
  • Reset to default — goes back to the original colours.

If a text colour falls below a 4.5:1 contrast ratio (the minimum of the WCAG AA accessibility standard), the panel warns you. It warns, it does not prevent.

Placing it by hand

These work in all three modes.

In content or a widget:

[pht_switcher]

Shortcode options:

  • show_label="no" — shows only the code instead of the name;
  • class="my-class" — adds a CSS class.

In a theme template (usually header.php):

<?php pht_switcher(); ?>

Customising with CSS

The switcher uses about 4 KB of CSS, only on the pages where it appears, and zero JavaScript in three of the four shapes. Every appearance option is a CSS variable on .pht-switcher (--pht-bg, --pht-fg, --pht-hover, --pht-radius…), so a theme can redefine them without !important.


The language suggestion bar

Someone who reaches the site in a language that is not their browser’s sees a small bar at the top offering the version in their language.

  • It suggests, it does not redirect. Redirecting by browser language breaks the page cache, and Google advises against it.
  • It appears only once. Choosing or closing answers for good.
  • It is turned on and off in Switcher → Suggest the language of the visitor. It is on by default.

Browser automatic translation

On pages already translated by the plugin, Chrome and other browsers stop offering “Translate this page” — their translation on top of ours would give worse text. In the source language the offer stays active: that is how a foreign visitor discovers the site exists in their language.

Publish.
Read it in
every language.

30,000 characters, one site, no card. The key arrives by email after checkout.