translate

translate 全局属性 是一个 enumerated 属性,用于指定在本地化页面时是否应翻译元素的可翻译属性值及其 Text 子节点,或者是否保持它们不变。

¥The translate global attribute is an enumerated attribute that is used to specify whether an element's translatable attribute values and its Text node children should be translated when the page is localized, or whether to leave them unchanged.

它可以具有以下值:

¥It can have the following values:

  • 空字符串或 yes,表示页面本地化时应翻译该元素。
  • no,表示该元素不能被翻译。

尽管并非所有浏览器都识别此属性,但它受到 Google Translate 等自动翻译系统的尊重,并且也可能受到人工翻译人员使用的工具的尊重。因此,网络作者使用此属性来标记不应翻译的内容非常重要。

¥Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such it's important that web authors use this attribute to mark content that should not be translated.

示例

¥Examples

在此示例中,translate 属性用于要求翻译工具不要翻译页脚中的公司品牌名称。

¥In this example, the translate attribute is used to ask translation tools not to translate the company's brand name in the footer.

html
<footer>
  <small>© 2020 <span translate="no">BrandName</span></small>
</footer>

规范

Specification
HTML Standard
# attr-translate

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also