Translate wordpress posts ( except <code> lines )

80 Views Asked by At

I use Deepl API plugin to translate posts. The posts all have code lines

< code > <div class="container"...... < /code >.

When I translate the post , it also translates what is in the < code > line inside. I do not want that !

I googled , but did not find. Would be happy if someone has some advice on what I could do there....

1

There are 1 best solutions below

0
On

using the DeepL API you can actually configure which parts to be translated.

You can add simple tags to your markup to make sure its ignored by the API.

Here's a sample:

<!DOCTYPE html>
<html>
  <body>
    <h1>My First Heading</h1>
    <p translate="no">My first paragraph.</p>
  </body>
</html>

Find more details here -> https://www.deepl.com/de/docs-api/html/