[Resolved] Language switcher + Elementor widget translation problem
This thread is resolved. Here is a description of the problem and solution.
Problem: After installing WPML and activating automatic translations from French to English and Spanish, the client encountered issues with the language switcher module not displaying correct pages and English-translated text widgets showing 'widget body' followed by a serial number instead of the translated text.
Solution:
There was another temporary issue in client's site which they fixed and it resolved the said issue.
We recommended checking for conflicts with other translation plugins, as this was identified as the cause of the issue. Additionally, we advised following our Elementor tutorial, particularly the sections on templates and widgets, which could potentially resolve the described problems.
If this solution does not apply to your situation, or if it seems 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. Should these steps not resolve your issue, please do not hesitate to open a new support ticket with us for further assistance.
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.
Background of the issue:
I just installed WPML and activated the automatic translation of my site (French) into English and Spanish. I am trying to use the language switcher module and ensure that text widgets display correctly on translated pages. Link to a page where the issue can be seen: hidden link
Symptoms:
The language switcher module doesn't work properly or doesn’t display the correct pages. Some pages work, while others don’t. On the English-translated pages, the text widgets don’t display the translated text but instead show 'widget body' followed by a serial number. This does not happen in the Spanish-translated version.
Questions:
Why doesn't the language switcher display the correct pages?
Why do the English-translated text widgets show 'widget body' instead of the translated text?
Thank you for contacting the support. I'm assigned this ticket and 'll try my best to help you fix the issue.
About the language switcher, I randomly checked the pages in your site and can see the switcher working fine. Can you point out the pages or places where the switcher isn't working as expected?
Please note that for the language switcher to work correctly on a page or post, the page or post in question should be translated completely and published. If the translation of that page/post is still in progress or is pending review, then you may experience the switcher not working correctly.
For the other issue regarding widget translation, I'm not sure which widget is this, however I see that "widget body - xxxxxxxxx" followed by a serial number here and there. Perhaps that's a compatibility issue.
For this widget problem, I recommend opening a separate ticket/chat, with more details about the widget and the plugin/theme providing it. Because as per forum policy we can only handle one issue per ticket. So you can get more to the point help, without mixing up several issues in one long ticket.
Please let me know about the language switcher issue in this ticket and I'll try my best to help you further on that matter.
Thank you for your help!
Yes, all the pages are published since I used the automatic translation feature, which translates and publishes the entire website automatically.
The language switcher works fine between the French and Spanish versions, but when switching to the English version, you can't go back to French or Spanish.
For example, when you're on the English homepage (hidden link) and try to switch to Spanish, it redirects to this page: hidden link instead of the correct Spanish homepage: hidden link.
Similarly, when you're on this page: hidden link and try to switch to French or Spanish, nothing happens.
I've noticed that the English version is not working properly at all. In fact, this same issue affects my second problem—the Spanish translation works perfectly on all pages, but the English version does not.
I think both issues are related and there might be a problem with sticky links. Maybe because the website was originally created in French and then translated into English, something that was originally in English (WordPress, Elementor, etc.) got translated again incorrectly? Because the Spanish version works fine!
I checked the /en home page and about us, for the first time it was the same as you mentioned but every attempt I made later on, worked fine. At first I could see /es/es/ (double language code) in the URL. But any subsequent retry was just fine. Please watch this screen recording hidden link and it is working just fine.
I then tried with other pages which I haven't opened yet and there I saw the same issue at first. I visited these pages in English and then trying to switch to Spanish, there was the same double /es/es/ in the URL. However, clicking once took me to the same English page and after that the URL in the switcher stayed and worked correctly. Here's my second screen recording showing this behavior (notice the address at bottom left when mouse is over a language switcher): hidden link
This even kept working if I closed the browser, opened again and even checked in another browser - means the pages having that double /es/es/ at first, were working fine later on.
I suspect something is causing a conflict. It could be the sticky links or any other plugin (i.e. caching, custom code snippets or etc).
Can you please try the following?
1) Take a full backup of your site and database before proceeding. It is highly advised to try these on a dev or staging site first, so your live site isn't compromised.
2) Deactivate all plugins except WPML and String Translation.
3) Switch to a standard theme like 2024 or 2021.
4) Clear all caches and check for the issue if it still happens.
5) Then start activating plugins one by one while keep checking for the issue. This way you 'll be able to pinpoint a conflict when & where it starts creating the problem.
6) If after activating all plugins you see that it still works fine, then switch to your theme and see if that's causing it.
Please let me know your findings and I'll try my best to help you further on the matter.
P.S.: I still believe that widget translation (showing the widget body and serialized numbers) is a separate problem. Does that widget show language switcher? If yes, then we can check about it, however, if those widgets are intended to show some other content, then please report separately.