If the HTML from the theme or other plugins is not very well formatted, it can sometimes cause issues when using TranslatePress and result in broken HTML.
For example, using duplicated attributes in a tag can cause missing attributes, which in turn can lead to unexpected behavior of the website when browsing a translated page.
How to fix broken HTML
Here are our solutions to fix this issue. Go to Settings → TranslatePress → Advanced tab.
- Activate option Fix spaces between HTML attributes first (attributes without spaces between them are not valid HTML).
- If the first fix doesn’t work, try activating the option Fix broken HTML. Only try this if you still have problems after using the first solution.
If your issue is still not solved, look for bad formatting in the missing HTML and correct it in the plugins/theme.
Common bad formatting includes duplicate attributes on the same tag, like the class attribute in the following example:
<div class="myclass1" id="myid" class="myclass2">
The correct version would be:
<div class="myclass1 myclass2" id="myid">