大网数据广告活动
Web 标准与前端开发

systemLanguage

· 52CE 我爱测

The **`systemLanguage`** attribute represents a list of supported language tags. This list is matched against the language defined in the user preferences.

The systemLanguage attribute represents a list of supported language tags. This list is matched against the language defined in the user preferences.

You can use this attribute with the following SVG elements:

  • a
  • animate
  • animateMotion
  • animateTransform
  • circle
  • clipPath
  • defs
  • ellipse
  • foreignObject
  • g
  • image
  • line
  • mask
  • path
  • pattern
  • polygon
  • polyline
  • rect
  • set
  • svg
  • switch
  • text
  • textPath
  • tspan
  • use

Usage notes

<table class="properties"> <tbody> <tr> <th scope="row">Value</th> <td><code><language-tags></code></td> </tr> <tr> <th scope="row">Default value</th> <td><em>None</em></td> </tr> <tr> <th scope="row">Animatable</th> <td>No</td> </tr> </tbody> </table>

  • <language-tags>
    • : The value is a set of comma-separated tokens, each of which must be a valid BCP 47 language tag.

systemLanguage is often used in conjunction with the switch element. If the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not.

[!NOTE] If several alternative language objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. It is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases.

The attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by a "-") of one of the language tags given in the value of this parameter. Otherwise it evaluates to "false".

[!NOTE] The prefix matching rule does not imply that if a user understands a language with a certain tag, that the user will also understand all languages with the tag as prefix.

If the attribute is not present, then it implicitly evaluates to "true". If a null string or empty string value is given, the attribute evaluates to "false".

The prefix rule allows the use of prefix tags if this is the case.

Multiple languages may be listed for content that is intended for multiple audiences. For example, content that is presented simultaneously in the original Maori and English versions, would call for:

<text systemLanguage="mi, en"></text>

However, just because multiple languages are present within the object on which the systemLanguage test attribute is placed, this does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to be used by an English-literate audience. In this case, the attribute should only include en.

Specifications

Browser compatibility

See also

  • requiredExtensions

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。