我刚为一家法国餐厅做了一个网站。该网站是英文的,但我猜网站上有足够的法语(标签菜单项的图片),提示访问者翻译网站如果使用Chrome。

有没有什么我可以添加到html,以防止chrome从要求翻译页面?我假设它会是类似于<html lang="en">,但这行不通。

什么好主意吗?

谢谢


当前回答

<head>中的元标记不适合我,但是

类=“notranslate”

添加到父div(甚至<body>)确实起作用,并允许更精确地控制您不想翻译的内容。

其他回答

新回答

在<html>标签中添加translate="no",如下所示:

<html translate="no">

MDN参考


旧的答案

(这应该仍然有效,但不太理想,因为它是谷歌特有的,而且还有其他翻译服务。)

在<head>和</head>之间添加这个标签:

<meta name="google" content="notranslate">

文档参考

<head>中的元标记不适合我,但是

类=“notranslate”

添加到父div(甚至<body>)确实起作用,并允许更精确地控制您不想翻译的内容。

用于不翻译页面的谷歌标记已更新为

<!-- opt out of translation features on all search engines that support this directive -->
<meta name="robots" content="notranslate">

or

<!-- opt out of translation features on Google -->
<meta name="googlebot" content="notranslate">```

欲了解更多信息,请查看此链接:

https://developers.google.com/search/docs/crawling-indexing/special-tags

https://developers.google.com/search/docs/appearance/translated-results


此外,我不得不更新这个,因为它不能在Edge浏览器上运行,只使用translate="no",如下所示:

<html translate="no">

因此,对于一个完整的解决方案,这里也提到了,我必须做这样的事情,不从搜索引擎翻译任何东西

<html lang="en" class="notranslate" translate="no">
  <meta name="robots" content="notranslate" />
  ...
</head>

有时候你需要阻止的不是所有的html,而是特定的元素,在这种情况下,你可以添加class="notranslate"只对该元素。 ie。<div class="notranslate"> some content </div>

我的Windows是德语。

我在Chrome上做了以下的体验: 如果我设置

<html lang="en" translate="no">

谷歌翻译提出建议翻译英语。

显然我要省略lang性质。这对我来说很管用:

<html translate="no">

没有弹出窗口,URL字段中的翻译图标不再显示。