|
↳ See all 15 articles
/ Documentation /Customizer Settings/Header & Footer/ Using Language Switcher Element with WPML

Using Language Switcher Element with WPML

The Language Switcher element adds language navigation to the header or footer of a multilingual website. It works automatically with WPML and Polylang, and with any other translation plugin through manually entered URLs.

Requirements

  • Astra theme with the Astra Pro plugin active and licensed.
  • A header or footer built with the Astra Header Footer Builder.
  • A translation plugin: WPML or Polylang for automatic setup, or any other plugin (such as TranslatePress or Weglot) for the Custom type.

Note: This feature requires Astra Pro. Learn how to upgrade.

How to Add the Language Switcher

If you’re looking to add a language switcher to your website header, follow the steps below. The same steps apply to the footer through the Footer Builder.

  1. Go to Appearance > Customize > Header.
  2. Hover over the row where the switcher should appear and click the + icon in the desired column.
  3. Select Language Switcher from the elements list.
  4. Click the Language Switcher element in the builder to open its settings.
  5. After configuring the element (see the next sections), click Publish.

This content is blocked because it requires Vimeo cookies.

Note:

The name of the header “Logo” element was modified, and the name you would see in your Header Builder is now “Site Title & Logo”

Choosing the Language Switcher Type

The Type setting decides where the element gets its languages from. It appears only when WPML or Polylang is active. Without either plugin, the element shows the Custom settings directly.

Custom: Lets you add each language and its URL manually. Use this for any other translation plugin.
WPML: Fetches active languages and their URLs from WPML automatically.|
Polylang: Fetches active languages and their URLs from Polylang automatically.

If you wish to add more languages, you can add them with WPML settings. For this, visit Dashboard > WPML > Settings > Languages > Site Languages > Add / Remove languages. From the list of languages, select the required ones and click on Save.

Add / Remove Languages, WPML

All selected languages from the step above will be available in your Header Builder with the Language Switcher.

You can customize the look of the language navigation with the following options:

Astra Pro, the Language Switcher Element
  • Layout: You can either display all languages in a horizontal or vertical manner. Horizontal layout mostly applies well to the header while the vertical layout is often better suited for the footer.
  • Show Country Flag: This will display flags for countries associated with the chosen language. It helps users to quickly spot the preferred language they are looking for.
  • Show Name: This will display the full name for the language.
  • Show Translated Name: This will display the translated names for all languages when a specific language is selected. For example – you added 4 languages, let us say English, French, German, and Hindi. When you select the German language, all languages will show their translated names in German.
  • Show Language Code: This will display the language code for each language. For example – English (en), French (fr), German (de), and Hindi (hi).

Under the Design tab, you can manage spacing, typography, and the size of the items.

Language Switcher with Other Translation Plugins

If you are using any plugin other than WPML, please follow the below steps to add language navigation:

This content is blocked because it requires Vimeo cookies.

Note:

The name of the header “Logo” element was modified and the name you would see in your Header Builder is now “Site Title & Logo”

Step 1 – Navigate to Customizer > Header Header > Language Switcher. Here, select the language from the dropdown and click on the “Add Language” button. You can repeat this step for all languages you wish to add.

Step 2 – Next, click on the language bar for a specific language. This will expand the language settings, allowing you to change its label (if needed) and set the appropriate URL. This URL is actually a translated version of your website (like https://www.yoursite.com/en/) and you can find it in your translation plugin. Just paste the URL there for the respective language.

Step 3 – You can manage other things from the above settings like the horizontal/vertical layout, show country flag, and display language name.

Step 4 – Under the Design tab, you can manage the spacing, color, and typography for the items.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Scroll to Top