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

Last updated by francoP-4 5 months ago.

Assigned support staff: Bruno Kos.

Author Posts
May 7, 2019 at 9:38 am #3755963

francoP-4

Hello,
in my woocommerce shop archive page I have added product filters by attribute and I am trying to modify the PLACEHOLDERS (not the attribute values list), such as 'Any price', 'Any occasion' where price and occasion are product attibutes. In French, for instance, those attribute PLACEHOLDERS are badly translated because they say 'TOUTE' which is feminine, also for masculin attributes. Anyhow, I'd rather remove ANY and TOUTE and just leave the attribute name. I looked everywhere for those strings, but could not find them. The theme author claims these are not added by them, but rather woocommerce.
How can I solve that, please?
Best regards
Franco
P.S. The site is not live yet and I cannot give you access. Here's a screenshot

May 7, 2019 at 9:57 am #3756073

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

The theme author claims these are not added by them, but rather woocommerce.

Can you tell me if you tried going through WooCommerce code to see if these placeholders are there?

You can search it here e.g.:
hidden link

Another way is to try using a plugin such as:
https://wordpress.org/plugins/string-locator/

And try searching these within all your plugins (if using some WooCommerce addons), maybe is it there somewhere?

Regards,
Bruno Kos

May 8, 2019 at 2:09 pm #3767571

francoP-4

Hello Bruno,

I installed the string locator plugin, but it is very diffcult to search because the 2 word string does not exist together but each of them appears too many times separately, especially in the woocommerce po files or plugins. Same for the EN couple. It looks like it is composed by the attribute name prefixed by "any" or "toute", but I cannot find where they do that. I am really stuck.

Best regards

Franco

May 8, 2019 at 3:20 pm #3768391

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

but each of them appears too many times separately, especially in the woocommerce po files or plugins.

In this case, you might want to try checking the placeholder code and search based on that, perhaps only search the field name or class. See my image on what I mean - in Google Chrome, you would right-click into the field and Inspect.

But when I re-read this:

, those attribute PLACEHOLDERS are badly translated because they say 'TOUTE' which is feminine, also for masculin attributes.

Have you checked .po files about these exact translations perhaps or String Translation (to see if there is a translation added already)?
https://wpml.org/documentation/getting-started-guide/string-translation/

Regards,
Bruno Kos

May 8, 2019 at 5:18 pm #3769515

francoP-4

Hi,

the first thing I tried is the string translations, that's where I go in the first place when searching for this kind of things. Even enabling the scan did not help.

As for the code here it is, but I don't see how I can search for that, can you please clarify?


<select class="woocommerce-widget-layered-nav-dropdown dropdown_layered_nav_categorie select2-hidden-accessible" tabindex="-1" aria-hidden="true"><option value="">Toute Catégorie</option><option value="bouquets">Bouquets</option><option value="cubes">Cubes</option><option value="deuil">Deuil</option><option value="fete-des-meres">Fête des mères</option><option value="plantes">Plantes</option><option value="roses">Roses</option></select>

It is the "Toute Catégorie" which I need to modify (catégorie it is an attribute, not a category) and it's a placeholder, the values are the next options, Bouquets, Cubes, etc.

Regards

Franco

May 9, 2019 at 6:38 am #3773345

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

This does not seem like a WooCommerce (or any plugin) default code, but rather a code rendered based on the given input. Based on this, would you be interested in trying this instead - would it work in your scenario?
https://stackoverflow.com/a/30795020

Regards,
Bruno Kos

May 13, 2019 at 12:26 pm #3798127

francoP-4

Hi Bruno,

in the end I managed to find the string (which is in /wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-layered-nav.php, line 248) in the WPML string translations. I should have looked for 'Any %s'.
I could then fix the translations.
However, how do I change the EN string?

Regards
Franco

May 13, 2019 at 1:21 pm #3798617

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

On that line, I see this:

			$any_label      = apply_filters( 'woocommerce_layered_nav_any_label', sprintf( __( 'Any %s', 'woocommerce' ), $taxonomy_label ), $taxonomy_label, $taxonomy );

this part:

'Any %s', 'woocommerce'

Means that you should be able to find "Any %s" string within woocommerce domain in String Translation (if it is not there, you can go to WPML -> Theme and plugins localization -> Strings in the plugins -> WooCommerce -> Scan).

But I am not sure I understand what you mean by this?

However, how do I change the EN string?

Regards,
Bruno Kos

May 13, 2019 at 1:28 pm #3798761

francoP-4

Yes, that's right, that's what I said and I found it. But how do I change the string, namely form 'Any %s' to '%s', for instance? I can change the translations, but how do I change the EN with WPML, which is the first language?

May 13, 2019 at 1:55 pm #3799149

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

You can translate it like this and also change the string translation language by checking the string and choosing a wanted language by clicking "Change the language of selected strings".

Regards,
Bruno Kos

May 13, 2019 at 2:06 pm #3799247

francoP-4

Thanks, that did it!