Home›Support›English Support›[Resolved] How to translate content inside a Custom HTML Block on a WordPress page or post?
[Resolved] How to translate content inside a Custom HTML Block on a WordPress page or post?
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're trying to translate content inside a Custom HTML Block in WordPress using the Advanced Translation Editor and find that the Custom HTML Block is not available for translation, this is because the Advanced Translation Editor is not designed for translating non-visual elements like HTML. It automatically copies the markup over to the translation, allowing only the included text to be translated. Solution: We recommend using the Classic Translation Editor, which supports HTML translation. You can learn more about using the Classic Translation Editor here. Alternatively, you can switch to the WordPress Editor for translating this content. This allows you full control over the HTML. For guidance on how to use different translation editors for different pages, please visit this link.
If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please do not hesitate to open a new support ticket here.
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.
Background of the issue:
I am trying to translate content inside a Custom HTML Block in a WordPress page or post using the Advanced Translation Editor.
Symptoms:
No Custom HTML Block available to translate in the Advanced Translation Editor.
I have tried:
Searching strings - no Custom HTML blocks come up for translation in String Translation which are related to the content.
Searching Admin Texts - no Admin Texts come up to add to String Translation to be able to translate the text in the Custom HTML Block.
Questions:
How can I translate content inside a Custom HTML Block using the Advanced Translation Editor?
Why is the Custom HTML Block not available for translation in the Advanced Translation Editor?
The downside would be that the Classic Translation Editor does not support automatic translation, translation memory and glossary features of the Advanced Translation Editor.
If we change it in the Classic Translation Editor or WordPress Editor, and then later make other changes in the Advanced Translation Editor, will we lose the changes to that HTML block?
Actually, you should stick to one translation method for the page that contains the HTML (note that the others will stay as they are, they don't get affected). If you switch to the Classic Translation Editor, you should keep it that way, for example.
My personal suggestion is for you to use the WordPress Editor in this situation. By switching to the WordPress Editor, you'll be able to create the translation as you wish and can have full control over the HTML. I recommend that you create a test post, switch to the WP Editor to test how it works. You can follow the steps on the link, here: https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/
For us, I think it would be hard to remember in the future that this one page should use the WordPress Editor and not the ATE. Because we will get so used to using the ATE as our 'one way' and 'right way' to do this, the brain may not remember which page should use the WordPress Editor, and which one shouldn't.
Could this be added as a feature request, to allow the ATE to bring in Custom HTML blocks for editing?
I can see multiple use cases for this. To give one example, if someone had a form they wanted to embed from a lead capture software (e.g. Hubspot, booking forms), they may want the form to be different for two different languages. This could then send data to the 'right' place, where it can be used by a person speaking the appropriate language.
In our case, we are trying to use a custom icon font to display an SVG that shows English letters. But, we want the Punjabi page to show Punjabi letters. There seems to be no other way to do this unless we either remember to always use the WordPress Editor, or change our CSS.
Markup can be used for different reasons, and there can be a need to translate this markup. It would help if WPML could consider adding support for translating Custom HTML blocks in WordPress.
When you open the translation, you will automatically open it in the chosen editor, there's no need to remember it. Furthermore, you don't need to always remember to use WP Editor in future cases. When a page contains HTML, use the WP Editor.
I'll create the feature request and keep you informed. To be honest, it's very unlikely that this will get implemented any time soon, as WP Editor already handles such cases and WPML is actually intended to translate other types of content, other than CSS classes, which is the case. I'll keep you informed, ok?
Thank you for submitting this request and being willing to keep us informed.
In this one particular case, yes we are speaking of a CSS class. However, I hope your team can see the other use cases that I mentioned, which would entail more reasons to allow this block to be translatable in the ATE.
The preference for doing it in the ATE is that it is the more up-to-date way, and will allow us to catch everything on the page in one 'go', as we are adding translations.
Thank you for notifying us that WPML will remember which translation editor a page is using. I do foresee that we will, at some point, 'naturally' and without thinking, switch to the ATE when we want to make changes to other parts of the page, since it is the easier translation method to use. This is especially because not all of our team members read in both languages. So having the original language side-by-side with the translation is more practical. I just worry that if we do this, then we will forget that we will lose the change on the Custom HTML block, which can easily be missed while someone is quickly trying to make a text change.
I hope you can understand what I'm trying to convey.
Thank you for your patience throughout this discussion.
Once more, to ensure: at this time, it’s not possible to translate Gutenberg HTML blocks directly using the Advanced Translation Editor (ATE). I understand this would be a convenient feature, but currently, WPML does not support this functionality, and there are no immediate plans for its implementation. As supporters, we don’t have insight into if or when this feature might become available. Your request is submitted internally, but there's no deadline or confirmation that will be implemented any time soon.
In the meantime, I recommend the following alternatives:
Thank you again for your understanding. Please don’t hesitate to reach out if you have any further questions. Otherwise, I'll close this ticket for the meantime.
Have a lovely rest of your day! 🙂
Best regards,
Lucas
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.