Why does Chrome incorrectly determine page is in a different language and offer to translate?
To stop Chrome from suggesting translations for your webpage, clearly state the language with the lang
attribute in the <html>
tag:
For content in numerous languages, tag each element with the appropriate language:
This directly informs Chrome of your content's language, avoiding unwanted translation offers.
Introduce your Document Type and Character Encoding
Kick off your document with the <!DOCTYPE html>
declaration to set the HTML standard, accompanied by the character encoding:
This will definitely help Chrome to decode and determine your content.
Every Attribute Counts
You can use Google-specific meta tags to ward off those unnecessary translation prompts:
Although it's not in the HTML attribute standard set, it has been proven to effectively signal to Chrome to skip translation offers.
Make it Louder! Use Explicit Language Specifications
Just in case everything else fails, belt it out with the Content-Language HTTP-equivalent meta tag:
This indeed sends a cue to the browser, although it isn't as frequently supported for language declarations as the lang
attribute.
Post-deployment Playground
After unleashing your website, if Chrome is still bugging you to translate, ensure to:
- Take a deep breath, relax, and restart, or even better, update Chrome.
- Be sneaky! Place tricky or mixed-script text in a hidden div—what Chrome doesn't see, won't make it react!
- Whisper to those elements: "Quiet now, Chrome shouldn't translate you"
Get Chrome to Respect Boundaries
Sometimes, you just have to set boundaries. Use the notranslate
class on elements you don't want tampered with:
Demystifying Chrome Triggers
Are you the curious type? Try researching around Google's n-gram algorithms to understand Chrome's possible 'go' signal for translation features.
Your CMS Has Your Back
If you've got a CMS to manage your site, check its manuals! They'll tell you how to set those translation tags just right.
Iterative Improvement
Just like in cooking, keep tasting and adjusting the flavor until it's perfect—you know how your website does not taste, I mean, translate correctly!
Let's Play Hide and Seek with Form Fields
Form fields can be like that kid who screams too loudly—it can influence how Chrome interprets the language. Let's duct tape...oops! Tell the form fields to be quiet and invisible to translation:
Checking Your Headers
It wouldn't hurt to review your server's HTTP response headers to ensure they're telling Chrome the right language specification, such as charset
and Content-Language
.
External Resources Can Be Your Spotlight
Don't shy away from checking external resources such as developer portfolios and case studies that give insights on dealing with translation issues. Go on, borrow the spotlight!
Turn the Translation Dial
The translate
attribute can be your magic dial giving you control over elements which should be in the translation party or sit it out:
Was this article helpful?