How can I tell Google Translate to not translate a section of a website?
To stop Google Translate from translating a section of your website, all you need is the class="notranslate"
attribute:
This maintains your content's natural form in the midst of translation waves.
Exploring the class "notranslate"
By placing the attribute class="notranslate"
within your HTML code, you put up an invisible shield around your content. Perfect for precious content that needs to be kept untranslated.
The HTML's translate attribute
Got to emphasize, there is another road - the translate="no"
attribute introduced in HTML5:
Though it's swimming under the radar, it is increasingly supported by many modern web warriors (browsers) and translation software.
Deploying the meta tag
If you want to shut off all translation, you might want to meet with Google directly in <head>
with the trusty <meta>
tag:
Consider it like saying to Google, "Hey, no translations here, buddy!"
Granular level control
Instead of a broad approach, you can use the notranslate
class on specific sections like <span>
or <div>
tags. A sniper targeting fine details rather than using the "nuclear option".
Handling translation quality
Google Translate loves simple and clear sentences. So rewriting complex sentences into simple ones can help achieve better translations. But keep in mind, Google isn't Shakespeare; it doesn't always natively understand every nuance of human language.
User-driven content
On forums or comments sections, users' expressive freedom might get lost in translation. To curb this, use the right class or attribute to exclude these areas from Google's translation services.
Text infused images
Fun fact: Even though Google is smart, it isn't smart enough to translate text embedded in your images. If you've got essential text in images, consider providing alternatives like captions.
Was this article helpful?