Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client wants the language switcher in the nav bar to display the name of the other language instead of the active language. The site uses Gutenberg blocks, and the switcher currently shows only two letters representing the active language (German), but the client wants it to display the name of the other language (French).
Solution:
We recommend two methods to achieve this:
Method 1: Hide the current language using CSS
1. Edit the Language Switcher block.
2. Set the "Layout" to list.
3. Add the following CSS in the custom CSS section of the theme:

.wpml-language-switcher-block li[data-wpml="current-language-item"] {<br />    display: none !important;<br />}

Method 2: Add language switcher using shortcode
1. Go to the WPML >> Languages page.
2. Enable the Custom Language Switcher.
3. Replace the language switcher block with a shortcode block and use the following shortcode:

[wpml_language_selector_widget]

For more details, visit this documentation.

If these solutions do not resolve your issue or if they seem outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.

0% of people find this useful.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Noman 2 weeks, 2 days ago.

Assisted by: Noman.

Author Posts
November 7, 2024 at 1:08 pm #16377281

walterS-22

Background of the issue:
I am trying to configure the language switcher in the nav bar of my site hidden link. I want the switcher to show the name of the other language instead of the active language. The website is built using Gutenberg-blocks.

Symptoms:
The language switcher currently shows only two letters representing the active language (German), but I want it to display the name of the other language (French).

Questions:
How can I configure the language switcher-block to show the name of the other language instead of the active one?

November 7, 2024 at 2:18 pm #16378075

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Currently it’s not possible to hide the current language using the Language Switcher block. This feature request is already submitted to our developers and I’ll add your ticket link there to up vote it.

As a solution, you may try any of the below methods:

Method 1: hide the current language using CSS
1. Edit the Language Switcher block.
2. Set the “Layout” to list as you can see in the attached screenshot.
3. Add the below CSS in the custom CSS section of the theme:

.wpml-language-switcher-block li[data-wpml="current-language-item"] {
    display: none !important;
}

Method 2: Add language switcher using shortcode
1. Go to the WPML >> Languages page.
2. Enable the Custom Language Switcher as you can see in the attached screenshot.
3. Replace the language switcher block with short code block and use the below short code:

[wpml_language_selector_widget]

Here is a doc for more details:
https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/#language-switcher-shortcodes

Please let me know if this resolves the issue or if you need further assistance with this issue.
Thank you

Block settings.png
enable custom language swithcer.png