# Excluding Content

> Exclude specific elements, sections, or content types from the translation widget.

Source: https://docs.oursprivacy.com/docs/translate/excluding-content

Use this page to keep specific HTML elements from being translated. To protect a recurring brand name or term wherever it appears on the page, see [No-Translate Terms](https://docs.oursprivacy.com/docs/translate/no-translate-terms) instead.

***

## Using data-translate-skip

Add the `data-translate-skip` attribute to any element to exclude it and all its children from translation:

```html
<!-- This entire section will not be translated -->
<div data-translate-skip>
  <h2>Brand Name</h2>
  <p>Tagline that shouldn't change</p>
</div>
```

```html
<!-- Single element exclusion -->
<span data-translate-skip>TM</span>
```

***

## Common Exclusion Scenarios

### Brand Names & Trademarks

```html
<header>
  <span data-translate-skip>Acme Healthcare</span>
  <nav><!-- Navigation will be translated --></nav>
</header>
```

### Legal Text

```html
<footer>
  <div data-translate-skip>
    © Company Name. All rights reserved.
    <a href="/terms">Terms of Service</a>
  </div>
</footer>
```

### Code Snippets

```html
<pre data-translate-skip>
  <code>const apiKey = "your-key-here";</code>
</pre>
```

### Proper Nouns & Technical Terms

```html
<p>
  Our platform integrates with
  <span data-translate-skip>Salesforce</span>, <span data-translate-skip>HubSpot</span>, and
  <span data-translate-skip>Marketo</span>.
</p>
```

***

## Automatically Excluded Content

The widget automatically skips these elements without any configuration:

| Element/Selector        | Reason            |
| ----------------------- | ----------------- |
| `<script>`              | Code, not content |
| `<style>`               | CSS, not content  |
| `<input>`, `<textarea>` | User input fields |
| `<iframe>`              | External content  |
| `<noscript>`            | Fallback content  |
| `display: none`         | Hidden content    |
| `visibility: hidden`    | Hidden content    |

For any other content you want to exclude, use the `data-translate-skip` attribute.

***

## CSS Class Exclusion

You can also use CSS classes for bulk exclusions:

```html
<style>
  .no-translate {
    /* Your styling */
  }
</style>

<div class="no-translate" data-translate-skip>Content to exclude</div>
```

***

## Parent-Child Inheritance

The `data-translate-skip` attribute cascades to all child elements:

```html
<article data-translate-skip>
  <!-- Everything in this article is excluded -->
  <h1>Title</h1>
  <p>Paragraph</p>
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
  </ul>
</article>
```

***

## Exclude at the Most Specific Level

`data-translate-skip` covers everything inside the element it is on, so put it on the narrowest element that should stay untranslated:

```html
<!-- Don't do this -->
<div data-translate-skip>
  <p data-translate-include>This won't work</p>
</div>

<!-- Do this instead -->
<div>
  <p data-translate-skip>Excluded text</p>
  <p>This will be translated</p>
</div>
```

***

## Dynamic Content

The `data-translate-skip` attribute works for dynamically-added content too. Any new elements with this attribute will be automatically excluded.

```javascript
// Dynamically added content with exclusion
const el = document.createElement('div');
el.setAttribute('data-translate-skip', '');
el.textContent = 'This will not be translated';
document.body.appendChild(el);
```

***

## Best Practices

1. **Be specific**: Apply exclusions to the smallest element necessary
2. **Brand consistency**: Exclude brand names, product names, and trademarks
3. **Legal content**: Consider excluding legal text that must remain in original language
4. **Technical terms**: Exclude industry-specific terms that shouldn't be translated
5. **Test thoroughly**: Verify exclusions work as expected in all languages

***

## Next Steps

* [Protect brand names and terms](https://docs.oursprivacy.com/docs/translate/no-translate-terms) everywhere they appear
* [View supported languages](https://docs.oursprivacy.com/docs/translate/supported-languages)
* [Common questions](https://docs.oursprivacy.com/docs/translate/faqs)
