Exclude a certain text or element from being translated

If you are looking to exclude a certain HTML element from being translated, you can achieve this by using the attribute: data-no-translation.

Attributes provide additional information about HTML elements.

Let’s say we want to exclude a certain paragraph of text from being translated.

<p data-no-translation>
This is a paragraph of text that will be excluded from translations.

This can be easily done for any HTML element (list, form, div etc.) to exclude it from being translated.

Note: This will exclude from being translated all the element’s child elements.

There are also two filters where you can add other selectors to be excluded.