6

This question already has an answer here:

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?

screenshot of page showing translate option

marked as duplicate by DisgruntledGoat, John Conde google Jun 2 '17 at 10:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

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:
https://stackoverflow.com/questions/9628507/how-can-i-tell-google-translate-to-not-translate-a-section-of-a-website

  • 2
    Well researched with an outstanding recommendation. I wish I could up vote again! Cheers!! – closetnoc Jun 1 '17 at 14:54
  • 1
    Thank you! I actually removed another special character but for some reason didnt check my email (it is using an online obfuscator called enkoder, I didnt know about the usability issues either) – Niahc Jun 2 '17 at 14:24
3

Try this in the <head> section:

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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.