Skip Navigation

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

Problem: Widget translation not working

Solution: The first option is to upgrade the WPML Multilingual CMS plugin to version 4.6 beta. This should resolve the issue. Beta upgrade guideline: https://wpml.org/faq/how-to-install-beta-and-development-versions-of-wpml/

Alternatively, you can edit the wp-content/plugins/sitepress-multilingual-cms/classes/widgets/class-wpml-widgets-support-frontend.php file on line 30 and replace:

add_filter( 'widget_block_content', [ $this, 'filterByLanguage' ], - PHP_INT_MAX, 1 );

with

add_filter( 'widget_block_content', [ $this, 'filterByLanguage' ], 0 );

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.

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by Faisal Ahammad 1 year, 1 month ago.

Assisted by: Faisal Ahammad.

Author Posts
February 24, 2023 at 12:45 pm #13108329

danutaJ

Tell us what you are trying to do?
I am trying to translate the strings of widgets. I can see that as correctly translated at the back-end panel, but when visiting the website as a regular user, they are still displayed in the default language.

Is there any documentation that you are following?
Yes, it is here:
https://wpml.org/documentation/theme-compatibility/translating-generatepress-theme-using-wpml/
https://wpml.org/forums/topic/widget-translation-issue-english-translation-disappear/
https://wpml.org/documentation/getting-started-guide/translating-widgets/

Is there a similar example that we can see?
You can check yourself via wp-admin. How do I provide login and password?

What is the link to your site?
This is a testing site with fresh WP installation
hidden link

February 24, 2023 at 12:51 pm #13108431

danutaJ

Same problem with default WordPress themes. It is not related to the GeneratePress theme only.

February 25, 2023 at 5:18 am #13113079

Faisal Ahammad

Hi there,

Good morning. I hope you're doing great.

Please share the access details to your site with me. I’m enabling a private message for the following reply.

Privacy and Security Policy:
We have strict policies regarding privacy and access to your information. Please see: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**
- Please backup the site files and database before providing us access.
- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.

Have you attempted to create widgets in each language from the provided link https://wpml.org/documentation/getting-started-guide/translating-widgets/#using-different-widgets-for-different-languages? Did you experience any difficulties while following this guide?

I'll look forward to hearing back from you.

Best regards,
Faisal

February 25, 2023 at 11:50 am #13113615

Faisal Ahammad

Good afternoon! I attempted to replicate the issue on my local server but was unsuccessful. Could you please downgrade your PHP version to either v8.0.x or v8.1.x and let me know if the issue persists?

If it does, please let me know so I can create a sandbox server on our Cloudways server to make a copy of your site. This way, we can investigate the issue further without affecting your live site.

I look forward to hearing from you soon.

Best regards,
Faisal

February 25, 2023 at 12:49 pm #13113709

danutaJ

Hello

I tried with both PHP versions 8 and 8.1 but without success :(. My hosting provider is KnownHost.com. The same problem replicated with fresh WP installation at Smarthost provider.
How do you want to make a copy of my site? You can use my live site for testing if you want, I made it specially to replicate this error.

Thank you for your help.

Pawel

February 25, 2023 at 1:56 pm #13113823

danutaJ

Hello

Migration finished, you can start testing at your location.
I successfully replicated the problem, widget translation are not working.

Pawel

February 26, 2023 at 11:35 am #13116497

Faisal Ahammad

Good evening, Pawel,

I have forwarded your issue to our second-tier support team for further investigation. I will provide you with an update as soon as I hear back from them.

Your patience is greatly appreciated.

Best regards,
Faisal

February 27, 2023 at 7:57 am #13119977

Faisal Ahammad

Hi Pawel,

Good morning! Our second-tier support team has identified two potential solutions to your issue.

The first option is to upgrade the WPML Multilingual CMS plugin to version 4.6 beta. This should resolve the issue, and our team has confirmed this after testing on your sandbox site in Cloudways. You can find detailed step-by-step instructions for installing the beta version of WPML here: https://wpml.org/faq/how-to-install-beta-and-development-versions-of-wpml/.

Alternatively, you can edit the wp-content/plugins/sitepress-multilingual-cms/classes/widgets/class-wpml-widgets-support-frontend.php file on line 30 and replace:

add_filter( 'widget_block_content', [ $this, 'filterByLanguage' ], - PHP_INT_MAX, 1 );

with

add_filter( 'widget_block_content', [ $this, 'filterByLanguage' ], 0 );

This should also resolve the issue. Before attempting either of these solutions, please remember to back up your website completely.

I hope this helps. Please let me know how it goes!

Best regards,
Faisal

February 27, 2023 at 8:22 am #13120191

Faisal Ahammad

Hi,
Great to hear that the issue has been resolved! If you require any additional assistance in the future, please do not hesitate to open a new ticket.

Our team will be more than happy to help you.

Thank you,
Faisal

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.