Exclude content from translation
Keep some parts untranslated
To prevent content from being translated, mark it as 'untranslatable' by adding the translate="no"
attribute to the relevant HTML elements.
<p translate="no">This will not be translated</p>
Some of my content is in another language
Content in a language other than the source language should be marked with a language attribute. Failure to identify such content as untranslatable or belonging to a different language may result in incorrect translation and content corruption. The Website Translator currently supports translation from a single source language.
<p lang='ja'>これを訳して</p>
Explicitly mark the content that should be translated
To restrict translation to specific elements, mark those elements with the translate="yes"
attribute and enable the WebsiteTranslator.Options.translation.translateOnlyAllowedTags=true
configuration option. Any content without the translate="yes" attribute will remain untranslated. For finer control, use the translate="no"
attribute to exclude specific child elements from translation.
<html lang="en">
<head>
<script type="text/javascript" src="https://unpkg.com/@tilde-nlp/website-translator/dist/widget.js"></script>
</head>
<body>
<div class="website-translator"></div>
<!-- This will be translated because it inherits document language "en"-->
<p>This will be translated</p>
<!-- This will not be translated because it has translate="no" attribute-->
<p translate="no">This will not be translated</p>
<!-- This will not be translated because it has different language from document source language -->
<p lang='ja'>これを訳して</p>
<ul translate="no">
<!-- This will not be translated because it inherits translate="no" attribute-->
<li>Coffee</li>
<!-- This will be translated because it overrides inherited translate="no" with translate="yes"-->
<li translate="yes">Tea</li>
<!-- This will not be translated because it inherits translate="no" attribute-->
<li>Milk</li>
</ul>
</body>
<footer>
<script>
// Configure plugin
// 👇 Change XXXXXXXXXXX to your Client-ID
WebsiteTranslator.Options.api.clientId = "XXXXXXXXXXX";
WebsiteTranslator.Options.api.url = "https://services.tilde.com/service/website-translation";
WebsiteTranslator.Options.ui.toolbarPosition = "top";
WebsiteTranslator.Options.translation.translateOnlyAllowedTags=true;
WebsiteTranslator.Initialize()
</script>
</footer>
</html>