Excluding content
Some text shouldn't be translated, such as brand and product names, code samples, addresses, or a language switcher's own language names. Add the data-wg-notranslate attribute to an element to leave it, and everything inside it, in the original language:
html
<p>
Built by <span data-wg-notranslate>Arjo.dev</span> for agencies everywhere.
</p>
<div class="product-code" data-wg-notranslate>
SKU: UT-SINGLE-17
</div>The attribute needs no value. It applies to:
- the element's text, and the text of every element nested inside it
title,altand metacontentattributes on the element or its descendants
This is the same attribute Weglot's own JavaScript widget uses, so markup you've already prepared for Weglot carries over.
Where to add it
Add it in your templates and partial views, where you control the markup. Common candidates:
- the site name or logo text in the header and footer
- language switchers. The built-in switcher already has it, and any custom selector should too.
- code blocks, part numbers, prices with currency codes, email addresses
Umbraco's rich text editor may strip unrecognised attributes from content, so don't rely on editors adding data-wg-notranslate inside rich text. If editors need a "don't translate" option, give them a dedicated property (for example a text string for a brand name) and wrap it in the template:
razor
<span data-wg-notranslate>@Model.Value("brandName")</span>Excluding a whole page
There's no setting to exclude specific pages or content nodes from translation. A page is translated whenever it's requested under a language prefix. To keep a page's content in the original language, wrap its main content area in data-wg-notranslate in that page's template. To publish your own hand-written translation instead, see A real page always wins.