Skip Navigation

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

Problem:
The client has a widget with recommended posts created using WP Bakery that does not display a translation option, resulting in the sidebar widget showing the English version on all translated pages. The client also wants to remove the '(EN)' language code from the English version of the widget.
Solution:
We provided a workaround for translating the widget title:
1. Open the

app/public/wp-content/plugins/huber-plugin/shortcodes/gp_vc_blog.php

file.
2. Locate the following snippet around line 124:

<div class="gp-widget-title">

3. Replace it with the provided code that includes WPML filters and actions to register and translate the string.
4. Visit the page with the issue in the original language to register the string.
5. Go to WPML > String Translation and translate the string under the 'WordPress' textdomain.
6. Repeat these steps in the

gp_vc_showcase

file.
For the issue with the YARP plugin, we opened a separate ticket.

If this solution does not seem relevant to your issue, please open a new support ticket with us.

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 13 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 12 months ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
November 29, 2023 at 11:41 am #14949999

karelV-8

Hello, we have a widet with recommended posts made in WP Bakery widget, see attached. There is no option on the right side to translate it. See attached. So right now on all the translated pages the side bar widgets shows the English version. How can we translate it? I haven't found any solution in your guides...

1.png
November 29, 2023 at 11:47 am #14950083

karelV-8

And similar things for other widgets, like comments. And of course there should be just comments under the translated posts...

2.png
November 29, 2023 at 5:26 pm #14954515

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

thank you for reaching out to us. I have a solution for you that might work perfectly. Sometimes, widgets are not registered for translation by default, so I recommend you go to WPML > Themes and Plugins localization, select all Plugins and Themes and scan them. This way, you can ensure that texts will be available for translation on the String Translation tool. Here's a detailed step-by-step guide on how to do that:

https://wpml.org/documentation/getting-started-guide/translating-widgets/

Please follow these steps and let me know how it goes.

Have a nice day,
Lucas Vidal

December 2, 2023 at 9:41 am #14976983

karelV-8

I think this is not enough. Because I need to change categories visible under the right widget made in Bakery. But I can do it only in the English version. There is no possible translation like in a regular post where it's clear what language the post and Bakery fields these are...

That's just not possible currently.

Widget.png
December 2, 2023 at 9:44 am #14977017

karelV-8

This would be a solution but I don't see it there:

To use this feature, simply add or edit a widget on the Appearance → Widgets page in the WordPress admin area and choose which language to display it on using the dropdown.

December 2, 2023 at 10:22 am #14977041

karelV-8

I was able to find the strings where I can change even the categories. But even when it says that it was saved, on the live site it's not translated. Just the English translation is there. HTML cache in cloudflare is switched off. So, where is the problem now?

1.png
2.png
Missing.png
Recommended.png
3.png
December 4, 2023 at 4:21 pm #14989383

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

thank you for sharing the information. About the first solution I showed you, did it work to translate the widgets you showed in your first request?
For the other topics you sent (translating categories, shortcodes and strings) here are some guides you can follow to translate them:

1. How to translate categories: https://wpml.org/documentation/getting-started-guide/translating-post-categories-and-custom-taxonomies/
2. How to translate shortcodes: https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/
3. Why your translations are not showing on the front end: https://wpml.org/faq/why-arent-my-translated-strings-showing-up-on-the-front-end-of-my-site/#:~:text=Support-,Why aren't my translated strings showing up on the,to use WPML is 128M.

Please share your results. Those are the default ways to translate. If they do not work, I'll be here to further assist you.

December 4, 2023 at 6:13 pm #14990407

karelV-8

Hello. I think you don't really get it. This is not about categories, we have them all translated (even though one category is the same for both languages and I am unable to find out why).

This is also not about shortcodes.

This is about strings. They seem to be saved but they are not visible on the frontend neither in the admin. See attached. I just tried to translate the string for one sentence in the admin (that is 100% not cached). But there is still the original sentence in English and the word "Spanish" is completely missing there.

1. Translations are updated
2. Memory limit 512M
3. I have the correct string, there is no other duplicate
4. The string is not in the admin screens
5. I deleted manually all the cache, including APO in cloudflare

Nothing helps.

Yarp ESP.png
Translated.png
December 4, 2023 at 6:27 pm #14990479

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Ok, I see. It might be a compatibility issue. I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:

hidden link

December 5, 2023 at 8:20 pm #15002565
karelV-8

Hello. So... It is all there. See the attached image what should be translated.

Sidebar: I had to install visual sidebar editor plugin which is used to create sidebars for WPBakery Visual Composer.

Also, in functions.php there is this code to be able to work with it:
// Disables the block editor from managing widgets in the Gutenberg plugin.
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false', 100 );

// Disables the block editor from managing widgets. renamed from wp_use_widgets_block_editor
add_filter( 'use_widgets_block_editor', '__return_false' );

Here we talk about the word Recommended in the sidebar, you can find it here hidden link

Also, YARP plugin for related posts, showing related posts below the current post is also not possible to translate using strings.

And well, then there is the whole comment section, I believe that you have a working solution for that, I just don't know where I can find it.

Thanks!

New threads created by Lucas Vidal de Andrade and linked to this one are listed below:

https://wpml.org/forums/topic/split-translate-comment-section/

https://wpml.org/forums/topic/split-yarp-plugin-not-translatable/

To translate.png
December 8, 2023 at 11:06 am #15024921

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Indeed, it was a compatibility problem. The title provided by your theme was not properly set so it could be translated. Our developers came up with a workaround:

• Open the app/public/wp-content/plugins/huber-plugin/shortcodes/gp_vc_blog.php file
• Look for the following snippet (around line 124)

<div class="gp-widget-title">

•Replace it with the following code:

<div class="gp-widget-title">
	<?php
		// WPMl Workaround for compsupp-7082
		if (class_exists('Sitepress')){
			$string = $widget_title;
			$textdomain = 'WordPress';
			$string_name = 'WPML Workaround : '.substr($string, 0, 20);
			
			$wpml_default_lang = apply_filters('wpml_default_language', NULL );
			$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
			
			if ($wpml_default_lang == $wpml_current_lang ) {
				do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );
			}	
			// Apply the translation to the string
			$string = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
			
			$widget_title = $string;  // Replace the title
		}
	?>

• Visit the page with the issue in the original language, to register the string
• Go to WPML > String Translator and translate the string (under WordPresstextdomain)
• Repeat these steps in the gp_vc_showcase file

Please let me know if you need any assistance on doing that.

As for the YARP plugin, I opened a new ticket, so we can look at it separately:
https://wpml.org/forums/topic/split-yarp-plugin-not-translatable/

December 8, 2023 at 11:18 am #15025155

karelV-8

Alright, does it work for all the terms in Bakery? However, there is one issue, you put (EN) to the English version. I don't want to have EN there, it's obsolete... Otherwise, it seems ok on the Spanish version.

EN.png
December 8, 2023 at 11:25 am #15025275

karelV-8

Ah, ok, that was done by you... Thanks for your help!

December 8, 2023 at 12:07 pm #15025485

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Yes, I did that temporarily to identify the text easier. I'll mark this thread as resolved. Have a nice day!