: Why would my website language be incorrectly detected, and how do I set it to the right language? When I visit my personal website on my phone (chrome app), the page language is detected as
When I visit my personal website on my phone (chrome app), the page language is detected as 'Portuguese' and asks me if I want to translate it. However the page is in English and I have set the language to English using the tag:
<html lang="en">
Why is my page being registered as Portuguese and how can I prevent the translate button from triggering?
More posts by @Odierno851
3 Comments
Sorted by latest first Latest Oldest Best
One thing to note is that when Google suggests, "This page is in XYZ" and offers translation, it doesn't necessarily mean it thinks the entire page is in that language. Even if it thinks that just a very small part of the page is in that language it offers the same option to translate the page.
In your example, if you click on the translate link, the only part that appears to get "translated" is the visible local part of the email address. faith becomes Faith.
Checking the HTML source of the page shows that this element is (heavily) HTML entity encoded (the href attribute is both %-encoded (URL encoded) and HTML entity encoded) - presumably in an attempt to stop email harvesters:
<a href='mailto:f%61i%74%68%40fa%69th%62ot.c%6F%6D'>faith@faithbot.com</a>
It may be this encoding that is fooling Google translate? It may not be seeing it as an email address? I notice that in Chrome, the %40 (encoded @ ) is not decoded when Chrome shows the source of the link in the tooltip when the user hovers over it. Also, if the user selects "Copy email address" from the context menu, the email address that is copied is only HTML entity decoded, it is not %-decoded (ie. f%61i%74%68%40fa%69th%62ot.c%6F%6D) - so this is a potential usability issue.
Solution
According to the Google help docs, you can try adding the following tag around specific elements you don't want considered for translation:
<span class="notranslate">....</span>
You might just be able to add class="notranslate" to the anchor, or you may need the entire element, I'm not sure.
There is also a possibility you might be able to use HTML5's translate="no" attribute?
Reference: stackoverflow.com/questions/9628507/how-can-i-tell-google-translate-to-not-translate-a-section-of-a-website
I believe that using hreflang for language would solve the problem. What Steve is suggesting in the answer above might also work.
Try this in the <head> section:
<meta charset="UTF-8">
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.