Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 9 replies, has 0 voices.

Last updated by Marcel 7 months, 3 weeks ago.

Assisted by: Marcel.

Author Posts
November 15, 2024 at 12:31 pm #16408251

alexanderT-30

Background of the issue:
I am trying to use the language switcher on my website hidden link. I want to ensure that users can select a language without the page reloading prematurely.

Symptoms:
The language switcher reloads the page when clicked on mobile, preventing me from selecting the desired language.

Questions:
How can I prevent the page from reloading when the language switcher is tapped on mobile?
Is there a way to make the language switcher work on mobile as it does on desktop?

November 15, 2024 at 1:21 pm #16408528

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

I wasn’t able to reproduce the issue. I used the language switcher located within the hamburger menu. Could you provide more details? Did you use the language switcher behind the logo instead? If so, could it be redirecting the URL from the image to the homepage?

Looking forward to your response.

Best regards,
Marcel

November 15, 2024 at 1:24 pm #16408534

alexanderT-30

Hi Marcel,

This is an old problem, it has been there for years. I switched to elementor now and it is still here.

If you go to the site from a mobile device and click on the language switcher from the drop down menu and then click on the current language to reveal other languages in the dropdown it reloads the current language.

Did you visit the our website?

Alexander

November 15, 2024 at 1:39 pm #16408593

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi Alexander,

thanks for the infos. If I hadn’t visited your site, I wouldn’t have known you have two language switchers :). Here’s what I was able to reproduce:

1) Clicking on German opens the .de version.
3) Clicking back to English reloads the EN version.
- I can reproduce this using the Debug Tools with a Mobile breakpoint too.
- on a real mobile device it happens too, but I click the EN button faster, it's possible to click it before the refresh happens.

Do you have a staging environment where we can isolate the issue and run some tests? You could either replicate it using subdomains or set up a test instance pointing to "fake" domains via your local host file.

Best regards,
Marcel

November 15, 2024 at 1:54 pm #16408686

alexanderT-30

Hi Marcel,

Yes, thank you for checking the site. I was fiddling with the switchers all day trying to figure out the issue and having a different switcher in place as a replacement but coulnd not get that to work right too. I will remove the second switcher right now.

As for the staging environment I do not have but it should be ok to work on the live site I suppose. Creating a staging environment will take hours for me 🙁

If I am fast on the desktop - yes I can click on the needed language.

On the mobile device (iPhone) I cannot do that, once the dropdown is tapped it will proceed loading it even if I tap on the right language.

Alexander

November 15, 2024 at 2:07 pm #16408718

alexanderT-30

I was able to find this thread before I contacted with someone having the same issue, the link was shared but it was not posted in the original message.

The thread suggested that a custom css should be added:

.mobilex-menu .wpml-ls-current-language a {
pointer-events: none;
cursor: default;
}

I tried to add it through elementor for the whole site and in WPML settings but nothing works, the switcher still reloads the page.

Screenshot 2024-11-15 at 3.06.24 PM.png
Screenshot 2024-11-15 at 3.06.19 PM.png
Screenshot 2024-11-15 at 3.06.02 PM.png
November 15, 2024 at 2:40 pm #16408982

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

The CSS is correctly loaded in the site's source code, but it does not appear to be related to or a solution for this issue. The "mobilex" menu seems to originate from another theme or a third-party plugin.

Best regards,
Marcel

November 15, 2024 at 2:44 pm #16408990

alexanderT-30

I see, it seemed to me like the correct CSS code for the issue.

Not sure what you mean by "mobilex" menu seems to originale from another theme or a third-party plugin.

This problem has been existent on all my sites since the beginning. I reinstalled the site numerous times throughout the last 6 years and this menu was always like this. Regardless of the theme.

Do you have a correct CSS code to disable the click?

November 15, 2024 at 2:45 pm #16408993

alexanderT-30

By reinstall I mean I built a bunch of sites and they all had the same issue

November 15, 2024 at 2:47 pm #16408994

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

The "mobilex" you mentioned is part of a class name you shared, most likeley specific for a theme used in that case you checked. Unfortunately, I can't provide a workaround without further debugging and isolating the issue. We'll need access to a staging environment or duplicator copy to continue testing and determine the source of this refresh behavior.

Best regards,
Marcel

The topic ‘[Closed] Language Switcher’ is closed to new replies.