Context:
Our website is a custom theme from scratch. I'm trying to translate the HTML texts in our website but it is not showing on string translation and translation management in WPML.
Is there a way to convert this HTML texts to strings so that WPML can read it?
This is one of the key challenges with WPML, do you have to use WPML? [FluentC](https://www.fluentc.ai) would do this without the headache.
Is this one time for the HTML or is this a section that changes a lot? If it doesn’t change a lot you will have add the text to the page with html then write a piece of JavaScript that hides the original text and replaces the text in your HTML section.
If it changes a lot, then you are going to need to have a complicated translation
You will to write so JavaScript the takes the innerHTML from the sections and replaces them in your target HTML
In you post or page you added the custom html
<div> <span id=“translatetext1”>Text to Translate<>
Then in your post you add the text so WPML can see it
<p id=“originaltext1”>Text to Translate.
Then in the editor you give it an id tag
Then you write a piece of jQuery or JavaScript the takes the innerHTML from originaltext1 and moves it to translatetext1
The JavaScript also needs to hide/ display none the original text
Just an idea, hope it helps
You could wrap your texts inside esc_html_e() function, that would be the correct way if those texts are stored in theme files.
Then scan your theme for strings and it should appear in string translations.
<?php esc_html_e(‘This string needs to be translated’, ‘your-domain’); ?>
You need to ensure the texts are registered as translatable strings