Skip Navigation

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

Problem:

FacetWP - translated checkbox labels are not rendered with shortcodes.

Steps to replicate the issue

The ACF phase

1. Create a field group and add a checkbox field to it.

2. In the Choices field, add at least one choice; for example like this boy : Boy.

3. Save the field group.

The WordPress phase

1. Create a post and select the checkbox's choices and publish the post.

The FacetWP phase

1. Go to Settings -> FacetWP.

2. Add a new Facet: Ensure to select Facet type = Checkbox and Data source = [Field group name] Field name.

3. Save and copy the shortcode.

The Elementor phase

1. Edit the post with Elementor.

2. Add a Shortcode element and insert the Facet shortcode.

3. Add a `Posts` element. And under the FacetWP section `Enable FacetWP`.

4. Save the changes.

The WPML phase

1. Translate the post with the Advanced Translation Editor.

2. Add translation to the checkbox labels, and complete the translation.

3. Check the translated post on the front end and see that the checkbox labels are not showing the translation.

A workaround solution:

1. Take a backup of your site in case something goes wrong.

2. Add the following function to the functions.php file of your theme and save the changes.

// WPML Workaround for compsupp-6751
function wpml_compsupp6751_translate_facet_display_value( $label, $args ) {
	if ( class_exists('Sitepress') ) {
		$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', 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10), $label );
		}	
		// Apply the translation to the string
		$label = apply_filters('wpml_translate_single_string', $label , 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10) );
	}
    return $label;
}
add_filter( 'facetwp_facet_display_value', 'wpml_compsupp6751_translate_facet_display_value', 10, 2 );

3. On the front end, visit the page with the ACF fields in the original language. This will register the strings into Strings Translation.

4. Go to WPML -> Strings Translation and filter to show the FacetWP domain. Under it, you will find the strings with the name "Facet Display Value : *name". Those will be the label of the checkbox strings. Translate them into the other language.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Our compatibility team has contacted the FacedWP plugin developers, and we are trying to cooperate with them to solve this issue.

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

Last updated by marcoP-123 1 year, 7 months ago.

Assisted by: Itamar.

Author Posts
April 20, 2023 at 12:53 pm

marcoP-123

We use WPML, ACF and FacetWP on our website. Our issue is that when we switch the language from the original one to another, the filter options on the "products page" are displayed in the original language.

April 20, 2023 at 2:45 pm
April 23, 2023 at 7:09 pm #13523601

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

I've consulted my teammates regarding this issue. In other cases changing the "Return Value" of the field to "Label" instead of "Value" solved such an issue.

Can you please try it on your site and see if it helps?

Please disable and clear all the caching on your site when you try that.

Regards,
Itamar.

April 24, 2023 at 9:38 am #13525811

marcoP-123

Dear Itamar,

thank you for your support.
I have changed the return value of "Dauer" (Duration) to "Label" ("Beschriftung") and checked it on the frontend. Unfortunately, it did not work (see screenshots).

Screenshot 2023-04-24 at 11-31-58 Feldgruppe bearbeiten „Feinfilter“ ‹ Lumturo Academy — WordPress.png
Screenshot 2023-04-24 at 11-32-30 Lumturo Academy - a place of inspiration and learning.png
April 24, 2023 at 4:13 pm #13528739

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks for trying my suggestion.

I discussed this issue with our ACFML developer. And I also tried to replicate this issue on a test site but couldn't. Translation of checkbox labels works as far as we can see. But in your case, other plugins are involved. I checked your staging site and edited the homepage where the problem occurs. I could see that you are inserting a FacetWP shortcode inside an Elementor element. Please see the attached screenshot. We might be facing a compatibility issue here, either with FacetWP or with Elementor. We would like to ask your help in replicating this issue. I created a test site and installed and configured WPML with ACF and Elementor. You can access this site admin directly by pressing this link.

hidden link

I created a very simple field group with one checkbox field. You can see it here.

hidden link

Can you please install FacetWP on the test site and help us replicate this issue?

Thanks,
Itamar.

2023-04-24_16-53-47.jpg
April 26, 2023 at 9:22 am #13539375

marcoP-123

Hi, thank you for providing a testing site.

I have just installed the following plugins: FacetWP, FacetWP Multilanguage Support, and FacetWP Elementor.

I believe that the issue we are experiencing on our site is also present on the testing site you provided (please refer to the "Yes and No Post" -> hidden link).

In English, the values in the array are "yes" and "no" (which is correct, see english_post.png). However, when I switch the language to French, the post title and text are correctly translated, but the ACF field is not translated correctly (see french_post.png). It should display "FR yes" and "FR no" as translated via the String Translation menu. Please see the attached screenshot for reference (see string_translation_wpml.png).

Could you please confirm if I have understood the issue correctly? Or, if there is anything else that I should consider?

english_post.png
french_post.png
string_translation_wpml.png
April 27, 2023 at 12:35 pm #13549679

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks for trying my suggestions.

About not being able to see the translation here.

hidden link

It was not working because of certain settings. When I try it as it should be, it is working. Please see this page.

hidden link

I've come to this conclusion after discussing this issue with my team.

I'm sorry if I was not clear enough in my previous reply. I'm referring to the following I wrote:

But in your case, other plugins are involved. I checked your staging site and edited the homepage where the problem occurs. I could see that you are inserting a FacetWP shortcode inside an Elementor element.

What I want to ask you is the following. Please try to replicate the issue as things are configured on your site. Indeed Elementor and FacetWP are active. But you didn't insert the FacetWP shortcode in an Elementor Shortcode element like it was done on your site.

Can you please try to proceed like that and see if the issue can be replicated?

Thanks,
Itamar.

April 30, 2023 at 10:40 am #13562367

marcoP-123

Dear Itamar,

Thank you for your assistance! I followed your advice and placed the FacetWP shortcode within an Elementor Shortcode element. The result is that the FacetWP checkboxes are now being rendered correctly on the English version of the site, as you can see here: hidden link.

However, I encountered an issue with the French version of the site, as the FacetWP checkboxes are not being rendered correctly. You can see the issue here: hidden link.

Nevertheless, the listed posts on the French and English version display the correct labels.

I would appreciate any further suggestions you might have for resolving this issue. Thank you again for your assistance.

french_facetwp.png
english_facetwp.png
April 30, 2023 at 4:03 pm #13562915

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thank you for replicating the issue on the sandbox site.

After pressing the Re-index button in Settings -> FacetWP, the checkboxes are rendered correctly on the French page. However, the translations still do not show.

I'm consulting our second-tier supporters regarding this issue. When I have their reply, I will update you here.

Thank you for your patience.

Regards,
Itamar.

May 5, 2023 at 9:09 am #13592335

marcoP-123

Hi Itamar,

do you have any updates regarding the FacetWP translation issues?

Thank you and best regards

May 7, 2023 at 7:56 am #13599841

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

I still don't have news regarding this issue. I've just sent a note to our second-tier supporters and asked them for an update on this issue.

I'll keep updating you here.

Regards,
Itamar.

May 9, 2023 at 6:49 am #13609959

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Our compatibility developer has found a workaround for this issue. Here is what you need to do.

1. Take a backup of your site in case something goes wrong.

2. Add the following function to the functions.php file of your theme and save the changes.

// WPML Workaround for compsupp-6751
function wpml_compsupp6751_translate_facet_display_value( $label, $args ) {
	if ( class_exists('Sitepress') ) {
		$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', 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10), $label );
		}	
		// Apply the translation to the string
		$label = apply_filters('wpml_translate_single_string', $label , 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10) );
	}
    return $label;
}
add_filter( 'facetwp_facet_display_value', 'wpml_compsupp6751_translate_facet_display_value', 10, 2 );

3. On the front end, visit the page with the ACF fields in the original language. This will register the strings into Strings Translation.

4. Go to WPML -> Strings Translation and filter to show the FacetWP domain. Under it, you will find the strings with the name "Facet Display Value : *name". Those will be the label of the checkbox strings. Translate them into the other language. Please see the attached screenshot.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Now the problem on the translated page/post should be solved. You should see the translated checkbox field labels.

Please note that this is only a workaround we can provide for now as a temporary fix. Our compatibility team will also contact the FacetWP developers to work with them to fix this issue permanently. Please be aware that the permanent fix release also depends on the cooperation of FacetWP.

Can you please inform me if this workaround works for you?

Thanks,
Itamar.

facetwp-fix.jpg
May 9, 2023 at 9:15 am #13611701

marcoP-123

Dear Itamar,

thank you and also thanks to your compatibility developer for providing a solution! I am currently trying to check whether it also works on the staging site.
I am facing the following issue: the default language is German but the German strings are registered in English (see screenshot below). Is there a way to register them in German?

Thanks

Screenshot 2023-05-09 at 11-14-58_stringtranslation.png
May 9, 2023 at 9:18 am #13611757

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

You can switch the language of the string. Please read about it here.

https://wpml.org/documentation/getting-started-guide/string-translation/how-to-change-the-source-language-of-strings/

Regards,
Itamar.

May 9, 2023 at 9:33 am #13611881

marcoP-123

Thank you very much for you assistance!

As far as I am concerned it works. Do you know how I can remove the default language options (German)? See screenshot below

Screenshot 2023-05-09 at 11-31-10_filter_translation.png