且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么Chrome不正确地确定页面使用不同的语言并提供翻译?

更新时间:2023-02-06 14:02:59

使用以下内容:

Use the following:

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

如果这不起作用,您可以随时放置一堆文本(About页面例如)在一个隐藏的div中。这可能也有助于搜索引擎优化。

If that doesn't work, you can always place a bunch of text (your "About" page for instance) in a hidden div. That might help with SEO as well.

编辑(和更多信息)

OP在询问Chrome,因此 Google的建议 a>在上面发布。通常有三种方法可以为其他浏览器完成此功能:

The OP is asking about Chrome, so Google's recommendation is posted above. There are generally three ways to accomplish this for other browsers:


  1. W3C建议 :使用 lang 和/或 xml:lang 在html标记中的属性:

  1. W3C recommendation: Use the lang and/or xml:lang attributes in the html tag:

<html lang="en" xml:lang="en" xmlns= "http://www.w3.org/1999/xhtml">


  • Google建议 c> meta http-equiv (如上所述):

  • Google recommendation: meta http-equiv (as described above):

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


  • 使用HTTP标头(不建议根据跨浏览器识别测试):

  • Use HTTP headers (not recommended based on cross-browser recognition tests):


    HTTP/1.1 200 OK
    Date: Wed, 05 Nov 2003 10:46:04 GMT
    Content-Type: text/html; charset=iso-8859-1
    Content-Language: en