Skip Navigation

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

Problem:
If you're noticing that a product is not translating correctly, even though it appears translated in the translation dashboard and edit mode, but still displays in English on the front end in all languages.
Solution:
We recommend following these steps:
1. Navigate to Products -> Product Tabs.
2. Change the language to your secondary languages.
3. Delete the translated tabs.
4. Empty the trash.
5. Go to WPML -> Settings -> Post Type Translation.
6. Set the 'woo_product_tab' as Not Translatable.
7. Edit the file .../wp-content/plugins/woocommerce-product-tabs/src/Product_Tabs.php.
8. On line 58, replace the existing code with the following workaround:

$wpt_tabs[ $key ]['title'] = esc_attr( $prd->post_title );<br />// WPML Workaround for compsupp-7241<br />if ( class_exists('Sitepress') ) {<br />    $string = $wpt_tabs[ $key ]['title'];<br />    $textdomain = 'WordPress';<br />    $string_name = 'WPML Workaround : '.substr($string, 0, 20);<br /><br />    $wpml_default_lang = apply_filters('wpml_default_language', NULL );<br />    $wpml_current_lang = apply_filters( 'wpml_current_language', NULL );<br /><br />    if ($wpml_default_lang == $wpml_current_lang ) {<br />        do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );<br />    }<br />    // Apply the translation to the string<br />    $string = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);<br /><br />    $wpt_tabs[ $key ]['title'] = $string;  // Replace the title<br />}

9. Visit the front end to register the new string.
10. Navigate to WPML > String Translation and translate the new string.

Please note that this solution might be outdated or not applicable to your case. If the issue persists, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

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.

Our next available supporter will start replying to tickets in about 5.13 hours from now. Thank you for your understanding.

Tagged: 

This topic contains 17 replies, has 2 voices.

Last updated by Osama Mersal 8 months ago.

Assisted by: Osama Mersal.

Author Posts
March 11, 2024 at 12:15 pm #15394886

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Our compatibility team has found a workaround for this case. Please check the following steps:

1- Go to Products-> Product Tabs
2- Switch the language to the secondary languages
3- Delete the translated tabs
4- Empty the trash
5- Go to WPML-> Settings-> Post Type Translation
6- Set the (woo_product_tab) as Not Translatable
7- Open .../wp-content/plugins/woocommerce-product-tabs/src/Product_Tabs.php file
8- Look for line 58 and replace the following code

$wpt_tabs[ $key ]['title']               = esc_attr( $prd->post_title );

With:

$wpt_tabs[ $key ]['title']               = esc_attr( $prd->post_title );
			// WPML Workaround for compsupp-7241
			if ( class_exists('Sitepress') ) {
				$string = $wpt_tabs[ $key ]['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);
		
				$wpt_tabs[ $key ]['title']   = $string;  // Replace the title
			}

9- Visit the front end to register the new string
10- Go to WPML > String Translation and translate the new string

I've applied these steps to the sandbox site. Please translate the strings in String Translation and check if the tabs will be translated correctly. (hidden link)

Best regards,
Osama

March 18, 2024 at 3:16 pm #15422185

dawoodH

Hello, thanks!

I did everything until step 9, but now I can't find where to register and translate the strings.
If I go on "Product Tabs" under "Products" the tabs are not translatable.
I also scanned the plugin in "Theme and plugins localization" but I still can't find the strings in "Strings translation"

Can you assist me with this?

Thank you 🙂

March 18, 2024 at 3:20 pm #15422209

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Please translate the strings via WPML-> String Translation. Kindly check this page. (hidden link)

Best regards,
Osama

March 18, 2024 at 3:47 pm #15422443

dawoodH

Fixed. Thank you so much for the support!