Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
527 views
in Technique[技术] by (71.8m points)

browser - How to specify your webpage's language so Google Chrome doesn't offer to translate it

I have a page that Google Chrome insists on thinking is in French. Here's a snapshot of it:

http://yootles.com/outbox/overcleverchrome.html

Note that I'm including a meta http-equiv tag to tell it that it's in fact in English:

<meta http-equiv="Content-language" content="en">

But it doesn't help. Is there anything else I can do to prevent this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Google Chrome currently requires several tags to make an (HTML5) document opt out of translation. Before doing this, you should be sure that you know your audience's language, as otherwise it will prevent foreign sites from properly translating your site.

The relevant tags are:

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

And here is a full example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="google" content="notranslate" />
  <meta http-equiv="Content-Language" content="en_US" />
 </head>
 <body>
  Dies ist ein Test Deutsch
 </body>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...