[Resolved] Avoid translation the "value" attribute of a HTML form
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.
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?
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?
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.
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.
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.
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.
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.
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!
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.