Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu June 03, 2023 . #class . #Google

How to Disable Google Translate from Translating Specific Word or Content

Do you want to disable Google Translate from translating a specific element for example paragraph, heading, etc.

Google Translate is a powerful tool that help us to translate our website's content for every language in a second.

Sometimes we might not want Google to translate a specific element or block of a content. That's why Google has provided a built in class to disable translation when necessary.

In this article, you'll learn how to disable Google Translate from translating a word, a sentence, or an entire webpage using built-in class provided by Google.

Span tag

This is the best way to tell Google to block translation for a word. Simply, add the notranslate class to the span tag.

<span  class="notranslate"> Don't translate this line. </span>

How to prevent a word from being translated inside a heading.

<h2> This is a <span  class="notranslate" > heading. </span><h2>

Div element

Add notranslate class to the specific div.

<div class="notranslate" > Don't translate this element. </div>

How to disable translation of an entire website.

To disable translation of an entire webpage, add the meta tag inside the head section of your website.

<meta name="google" content="notranslate"/>

Conclusion

In this article, you have learned how to disable Google Translate from translating specific words, sentence and entire website .

save
listen
AI Answer
2 Answers
  1. To prevent Google Translate from translating specific words or sentences in HTML, you can use the notranslate class provided by Google. Apply this class to the HTML elements you want to exclude from translation. For example:
    <p>This is a normal sentence.</p>
    <p class="notranslate">
            Do not translate this sentence.
    </p>

    By adding the notranslate class to the second <p> element, you're instructing Google Translate to skip translating the content within that specific element. This is a good way to maintain certain parts of your content in their original language.
    Reply Delete
    Share
  2. Another way to prevent specific content from being translated by Google Translate is by using the translate="no" attribute in HTML. You can apply this attribute to the HTML elements you want to exclude from translation. Here's an example:
    <p>This is a normal sentence.</p>
    <p translate="no">Do not translate this sentence.</p>

    Try it Yourself »
    By adding the translate="no" attribute to the second <p> element, you're indicating that the content within that element should not be translated. This provides an alternative method to achieve the same result as using the notranslate class.
    Reply Delete
    Share
Write Your Answer
loading
back
View All