Skip Navigation

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

Problem:
The client is experiencing issues with WPML translating the "value" attribute of HTML elements like

<input />, <option></option>

, etc., which is affecting the dynamic behavior of their forms. They have forms written in English and translated into Spanish, and they want to restrict the translation of the "value" attribute while allowing WPML to continue translating other attributes.
Solution:
1. If the forms are created using a page builder like Elementor and translated using the Advanced Translation Editor (ATE), the client can manually input the English values for the "value" attribute in the ATE for the Spanish page.
2. Our team has confirmed that WPML does not have a way to filter the content of HTML blocks specifically. Therefore, the best practice is to translate HTML blocks manually to ensure accurate translations.

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

Last updated by Marsel Nikolli 1 year, 6 months ago.

Assisted by: Marsel Nikolli.

Author Posts
October 19, 2023 at 2:35 am #14609629

o-i-wpml

Tell us what you are trying to do?

We have 4 plain HTML forms in our website, those forms are written in English, and we have translated them into Spanish, but, since the WPML also translates the "value" attribute of the HTML elements <inputs>, <options>, etc. Then, the dynamic behavior of the form is compromised.

So, how could we restrict the translation of this specific attribute, and let the WPML continue translating the rest of attributes that it use to translate?

Is there any documentation that you are following?

I was following this documentation: https://wpml.org/documentation/support/language-configuration-files/, but I cannot figure how to set this up.

What is the link to your site?

You can find 3 of these forms working here:
hidden link

And the respective Spanish page (not working as expected):
hidden link

October 20, 2023 at 8:27 am #14621547

Marsel Nikolli

Hi,

Thank you for contacting WPML Support.

1) It might not be related to your issue but I noticed from your debug info that you are using WPML v.4.6.5, I would suggest you update to the latest version (v.4.6.7).
IMPORTANT: Please make sure to have a full backup(database & files) before making any changes to your website.

2) Can you please tell me how you are creating that form on your website, are you using any page builder or another way?

3) How are you translating the form?

Looking forward to your reply,
Marsel

October 20, 2023 at 3:55 pm #14625761

o-i-wpml

Hi Marsel,
Thank you for your time to reply to this incident.

1) We're planning to update some plugins next week, we appreciate this recommendation.
2) We're using Elementor page builder, and the block used for that form is an HTML block with all the form in plain HTML5 (no frontend frameworks are used).
3) We're translating it with the ATE, at the contact-us page. See the attached image.

Value Attribute on ATE.png
October 23, 2023 at 9:17 am #14634895

Marsel Nikolli

Hi,

Thank you for your information and explanation.

Is the issue still going on, I checked the links you sent when you opened the ticked and noticed that the attribute "value" for the select options you showed me, is in English on both website languages.

In your case, you have the HTML form on an Elementor widget which (as seen on your attachment) you are able to translate, if English is the language needed for the attributes of you HTML form (in Spanish page), on the ATE you can simply put the English values instead of the translation.

Let me know if the issue is still happening.

Looking forward to your reply,
Marsel

November 2, 2023 at 5:57 pm #14720405

o-i-wpml

Hi Marsel,

Sorry for this late reply.

As you said, on those links this attribute (value) is in English in both languages, which is what we wanted. However, we had to do it manually by making the translated (Spanish) page independent. We obtained the translated HTML and manually reverted each value attribute to English.

Nonetheless, we need to relink this translation using WPML once it has been resolved.

Thank you for your time!

November 3, 2023 at 4:18 pm #14727279

Marsel Nikolli

Hi,

Thanks for the update.

To help me test the issue further, I've set up a sandbox site for you that you can log in to using the following link:

hidden link

It would be great if you could set up the HTML form that you're having trouble translating on that site and try to translate it.

On the sandbox site, please:

- Configure the WPML plugins the same way as on your website.
- Upload only the necessary plugins/theme to reproduce the issue.

Let me know once you've done this so I can take a closer look.

Thanks, and I look forward to your reply.
Marsel

November 7, 2023 at 8:37 pm #14751637

o-i-wpml

Thank you Marsel,

I've set the sandbox and could reproduce there the problem with the value attributes.

Here is the original English page:
hidden link

And here is the Spanish translation:
hidden link

Since we don't have automatic translation credits on this sandbox, I've just manually translated some fields in the beginning of the ATE tool.

However, as you can see in the ATE, all values attributes appear there, and the expected behavior is to keep them untranslated to let our plugin processing those fields in the right way.

Also, keep in mind that placeholder and title attributes do need to be translated.

Thank you again, Marsel, for your support.

Web capture_7-11-2023_153236_e.stg.ate.wpml.org.jpeg
November 8, 2023 at 4:45 pm #14759473

Marsel Nikolli

Hi,

Thank you for setting up the form on the sandbox, to further troubleshoot the issue I escalated this ticket to the 2nd tier support team.

I will update you as soon as I have an update from the team.

Thank you for understanding,
Marsel

November 8, 2023 at 6:28 pm #14760429

o-i-wpml

Perfect, thank you so much!

November 9, 2023 at 8:12 am #14762901

Marsel Nikolli

Hi there,

I got an update from the team, and they've confirmed that this is the expected behavior. WPML doesn't have a way to filter the content of HTML blocks, so it checks the entire block as a whole.

The best option in this case would be to translate HTML blocks manually(as you already did).
I know this isn't ideal, but it's the best way to ensure that your translations are accurate.

Thanks for your understanding.

Regards,
Marsel

November 15, 2023 at 2:16 am #14803617

o-i-wpml

Oh, that's a shame, ok, thank you so much for all your efforts to solve it.

I would like to know if the HTML attributes translation will become more customizable in future versions.

Thank you again and have a wonderful week!