为什么Chrome不正确地确定页面使用不同的语言并提供翻译? [英] Why does Chrome incorrectly determine page is in a different language and offer to translate?

查看:155
本文介绍了为什么Chrome不正确地确定页面使用不同的语言并提供翻译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的Google Chrome自动翻译功能正在我们的一个应用程序中的一页上跳跃。无论何时我们导航到此特定页面,Chrome都会告诉我们该页面是丹麦语并提供翻译。该页面是英文的,就像我们应用中的其他页面一样。这个特定的页面是一个内部测试页面,有几十个带有英文标签的表单域。我不知道为什么Chrome会认为这个页面是丹麦语。

The new Google Chrome auto-translation feature is tripping up on one page within one of our applications. Whenever we navigate to this particular page, Chrome tells us the page is in Danish and offers to translate. The page is in English, just like every other page in our app. This particular page is an internal testing page that has a few dozen form fields with English labels. I have no idea why Chrome thinks this page is Danish.

有人知道这种语言检测功能是如何工作的,以及如何确定是什么导致Chrome认为页面使用丹麦语?

Does anyone have insights into how this language detection feature works and how I can determine what is causing Chrome to think the page is in Danish?

推荐答案

使用以下内容:

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
    



  • 这篇关于为什么Chrome不正确地确定页面使用不同的语言并提供翻译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆