Mobile app version of vmapp.org
Login or Join
Odierno851

: 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

@Odierno851

Posted in: #Google #GoogleTranslate #Language #Translation #WebDevelopment

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?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno851

3 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

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='mai&#108;&#116;o&#58;f%61i&#37;74%68%40fa%&#54;9th%6&#50;ot&#46;c%&#54;F&#37;6D'>fai&#116;h&#64;faith&#98;ot&#46;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

10% popularity Vote Up Vote Down


 

@Eichhorn148

I believe that using hreflang for language would solve the problem. What Steve is suggesting in the answer above might also work.

10% popularity Vote Up Vote Down


 

@Hamaas447

Try this in the <head> section:

<meta charset="UTF-8">
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme