Skip Navigation

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

Problem:
The client wants to translate a FacetWP facet, specifically the "sort by" option, but it is not appearing in the translation view.

Solution:
We found a workaround that involves modifying the code. Here are the steps:
1. Replace the existing code:

<?php echo facetwp_display( 'facet', 'resultaat' );?>

with:

<?php echo facetwp_display( 'facet',  __( 'resultaat', 'harmless-child') );?>

2. This change allows us to scan the theme and register the shortcode call in the String Translation.
3. Change the language of the string to Dutch and create a new pager facet named: resultaat-en, or as the shortcode appears: resultaat_en.
4. Translate the registered string so the English version displays resultaat_en.
5. Apply the same method for other languages by creating a new facet and adding the shortcode of each language under String Translation to the string 'resultaat' of the domain 'harmless-child'.

We ask the client to test this solution and inform us of the results.

If this solution does not seem relevant, 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.

This topic contains 9 replies, has 2 voices.

Last updated by harmd-2 11 months, 4 weeks ago.

Assisted by: Mateus Getulio.

Author Posts
December 29, 2023 at 12:36 pm #15136705

harmd-2

I want to translate a FacetWP facet, the "sort by" option, but it does not show up in my translation view.

Pugins I already have:
- FacetWP
- FacetWP - Multilingual support
- WPML
- WPML String Translation

It seems to me that this is translatable under "Localization of theme and plug-ins," but unfortunately I can't get it to work.

Screenshot 2023-12-29 at 13.35.11.png
December 29, 2023 at 5:51 pm #15137340

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello there,

Let's try a procedure to register and translate those strings.

Please go to WPML -> String Translation and enable the option "Look for strings while pages are rendered", then visit the page in which those texts are located and go back to the String Translation, refresh the page and check if you'll be able to locate new strings now. (Please don't forget to uncheck the option "Look for strings while pages are rendered" once you're done). Translate the new strings and see if it gets the issue fixed.

If that doesn't work, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. 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.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

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 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

Please, let me know if you need any additional details. Have a nice day.

December 29, 2023 at 8:28 pm #15137582

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello there,

Thank you for sharing that access.

I investigated the issue and found that the strings originate from FacetWP. The problem happens because your site's primary language is Dutch, not English.

To resolve this, please follow these steps:

1. Navigate to FacetWP settings (wp-admin > Settings > FacetWP > Facets) and select 'Sort by' or 'Sorteren op.'
2. Change the English label texts to Dutch. For example, 'Title (Z-A)' should be changed to 'Titel (Z-A).'
3. Go to WPML -> String Translation and search for the Dutch texts, like 'Titel (Z-A).'
4. Change their language setting to Dutch.
5. Once the language is updated, translate these strings into secondary languages, including English.
6. Check the front end, and you should see the translations applied.

I've already applied these steps to 'Sort by,' and it worked as expected.

Please try these steps and let us know if there are any issues.

Best regards,
Mateus

December 30, 2023 at 1:50 pm #15138018

harmd-2

Hey Mateus

Thank you so much for your time and energy you put into helping me. I can indeed see now that things are going well in the sorting facet.

I just can't get the pager to work yet. I put the strings in dutch, but unfortunately they don't come up. I also checked the option that the strings are automatically indexed via front-end, but unfortunately this didn't help either. Do you know what is going wrong here?

Thanks!
I wish you good newyear's eve!
Best, Harm

Screenshot 2023-12-30 at 14.33.02.png
Screenshot 2023-12-30 at 14.32.54.png
December 31, 2023 at 2:19 pm #15138850

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello there,

I looked for an alternative and so far I wasn't able to find.

This is looking like a compatibility issue, in this case, we might have to reproduce this issue to a sandbox with a fresh WordPress + WPML install for us to isolate the cause. I'll then escalate this to the compatibility team for them to take a look.

Before we go that rout, I'd like to check a potential alternative.

In the facets listing, I can see that there are two different 'pagers', where in the site's settings you point which one you want to use? Is that done in the settings or in a page?

I'm thinking about creating different pagers for each language and then pointing each language to its specific pager.

Thank you, please let me know.
Happy new year!!

January 2, 2024 at 5:51 pm #15144418

harmd-2

Hey Mateus

First of all you too have a happy new year! Hope you had a great turn of the year.

I put the facets in the website code. I have specified in the file "/harmless-child/woocommerce/archive-product.php" which filters I want in which place.

So we can indeed place if-statements per language, and then load another facet. i just want to check the just check if it can also be done via translate, because then my client can add new languages themselves if needed. If we do it through the if-statements I have to help with other languages. That's not a problem, but just wanted to check with you to see if maybe you could find the problem.

Just let us know!
Best, Harm

January 3, 2024 at 3:01 pm #15147450

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hey there,

I checked this out but so far I couldn't find a different method to translate it.

I asked my colleagues to have a look at this issue in order to see if there's anything I'm missing.

I'll come back here as soon as one of my colleagues reply back to me (which it shouldn't take long).

Thanks,

January 3, 2024 at 3:27 pm #15147530

harmd-2

Thanks! I'll wait for your reply, thanks!

January 3, 2024 at 3:44 pm #15147638

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

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

Hello there.

I was able to find a workaround(please check the screenshot).

In the code you pointed out I replaced:

<?php echo facetwp_display( 'facet', 'resultaat' );?>

With:

<?php echo facetwp_display( 'facet',  __('resultaat', 'harmless-child') );?>

That allowed me to scan your theme and register the call of the shortcode in the String Translation.

I changed the language of that string to Dutch and created a new pager facet named: resultaat-en, or as the shortcode appears: resultaat_en.

I translated the string I registered above so the English version now shows resultaat_en.

The same can be applied to the other languages, basically create a new facet and add the sortcode of each language under String Translation to the string 'resultaat' of the domain 'harmless-child'.

Can you please test it and tell me how it goes?
Best,

aqua3.jpg
aqua1.jpg
aqua2.png
January 3, 2024 at 3:53 pm #15147727

harmd-2

Hey Mateus,

That's a clever solution. I have implemented this for the other 2 languages, and this works perfectly!

I want to thank you for your time and energy to help me with this problem! Thank you so much.

Kind regards, Harm