hreflang
Language of the Link Target
Language of the target to which a link is pointing. A processor following the link would expect to find a document in the language named.
Remarks
External Rather Than Internal Language: The @hreflang is not the language of the link itself or of the article or structural object in which the link is embedded. The @hreflang names the language of the document being pointed to.
Script and Language Codes: The value of this attribute should conform to IETF RFC 5646
(https://tools.ietf.org/html/rfc5646). For most uses, a primary-language subtag such as
“fr” (French), “en” (English),
“de” (German), or “zh” (Chinese) is
sufficient. These values are NOT case sensitive, but current best
practice uses all lower case. In addition to the primary language subtag, the value of this
attribute may contain other subtags as well. Values for the various subtags (which can be used in certain
combinations) can be obtained from the IANA Language Subtag Registry: https://www.iana.org/assignments/language-subtag-registry
In some languages, script codes are also critically important; for example, in Japanese, there is the need to express whether a name is in Kanji as opposed to in Kana (Hiragana or Katakana) to determine sort keys. Best practice is to use the full language-code-plus-script-code as the value for @hreflang. In our use of both language and script tagging as values for @hreflang, we are following the IETF (Internet Engineering Task Force) best practice guideline: Network Working Group Request for Comments: 5646 [Tags for Identifying Languages, A. Phillips and M. Davis, Editors, September 2009]. That document defines a language tag as composed of (in part):
- A language code Language (typically using the shortest ISO 639)
- Potentially followed by a hyphen and then a script code Script (using the ISO 15924 code)
- Potentially followed by a hyphen and a region code Region (using the ISO 15924 code)
Some sample values of @hreflang for Chinese and Serbian illustrate this complexity:
- Language subtag plus Script subtag: hreflang="zh-Hant" (Chinese written using the Traditional Chinese script)
- Language subtag plus Script subtag: hreflang="zh-Hans" (Chinese written using the Simplified Chinese script)
- Language-Script-Region: hreflang="zh-Hans-CN" (Chinese written using the Simplified script as used in mainland China)
- Language-Script-Region: hreflang="sr-Latn-RS" (Serbian written using the Latin script as used in Serbia)
Thus, for example, the following are among the expected values of @hreflang for Japanese, incorporating both a language (“ja”) and a script type:
- hreflang="ja-Hira" (Japanese written in Hiragana)
- hreflang="ja-Hrkt" (Japanese written in Hiragana + Katakana)
- hreflang="ja-Jpan" (Japanese written in Han + Hiragana + Katakana)
- hreflang="ja-Hani" (Japanese written in Kanji (Hanzi, Hanja, Han))
- hreflang="ja-Kana" (Japanese written in Katakana)
Used on Elements: <related-article>, <related-object>
Value | Meaning |
---|---|
An alphanumeric string, which may include hyphens | An abbreviation for a natural language (such as “en” for English or “de” for German) or for a language and a script (“ja-Kana”). |
Restriction | @hreflang is an optional attribute; there is no default. |
Example
...
<related-article id="ra1" related-article-type="alt-language"
hreflang="de" xlink:href="https://dx.doi.org/10.5414/ALP33164" ext-link-type="doi"/>
...