xml:lang
Language
The language of the intellectual content of the element for which this is an attribute.
The value of this attribute must conform to IETF RFC 5646
(http://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: http://www.iana.org/assignments/language-subtag-registry.
Remarks
Inheritance: The language value inherits down the tree, so an @xml:lang attribute names the language of the element and all its descendants, unless the descendant sets its own @xml:lang attribute. The default value of English (“en”) is set at the top-level element, and can be overridden there or anywhere lower in the document.
Script and Language: 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 @xml:lang. In our use of both language and script tagging as values for @xml:lang, 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 @xml:lang for Chinese and Serbian illustrate this complexity:
- Language subtag plus Script subtag: xml:lang="zh-Hant" (Chinese written using the Traditional Chinese script)
- Language subtag plus Script subtag: xml:lang="zh-Hans" (Chinese written using the Simplified Chinese script)
- Language-Script-Region: xml:lang="zh-Hans-CN" (Chinese written using the Simplified script as used in mainland China)
- Language-Script-Region: xml:lang="sr-Latn-RS" (Serbian written using the Latin script as used in Serbia)
Thus, for example, the following are among the expected values of @xml:lang for Japanese, incorporating both a language (“ja”) and a script type:
- xml:lang="ja-Hira" (Japanese written in Hiragana)
- xml:lang="ja-Hrkt" (Japanese written in Hiragana + Katakana)
- xml:lang="ja-Jpan" (Japanese written in Han + Hiragana + Katakana)
- xml:lang="ja-Hani" (Japanese written in Kanji (Hanzi, Hanja, Han))
- xml:lang="ja-Kana" (Japanese written in Katakana)
Used on Element: <article>
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”). |
Default value | en |
Used on these Elements:
<abbrev>, <abstract>, <ack>, <addr-line>, <address>, <aff>, <alt-text>, <annotation>, <anonymous>, <app>, <app-group>, <article-title>, <attrib>, <author-comment>, <award-group>, <award-id>, <bio>, <boxed-text>, <caption>, <chapter-title>, <chem-struct>, <chem-struct-wrap>, <city>, <code>, <collab>, <comment>, <conf-acronym>, <conf-date>, <conf-loc>, <conf-name>, <conf-num>, <conf-sponsor>, <conf-theme>, <conference>, <contrib-id>, <copyright-holder>, <copyright-statement>, <country>, <data-title>, <date-in-citation>, <day>, <def>, <def-item>, <def-list>, <degrees>, <disp-formula>, <disp-formula-group>, <disp-quote>, <edition>, <element-citation>, <email>, <era>, <etal>, <ext-link>, <fig>, <fn>, <fn-group>, <fpage>, <funding-group>, <funding-source>, <funding-statement>, <glossary>, <gov>, <graphic>, <inline-formula>, <inline-graphic>, <inline-supplementary-material>, <institution>, <institution-id>, <issue>, <issue-id>, <issue-part>, <issue-title>, <journal-id>, <kwd-group>, <label>, <license>, <list>, <list-item>, <long-desc>, <lpage>, <media>, <mixed-citation>, <month>, <name>, <named-content>, <nlm-citation>, <on-behalf-of>, <open-access>, <p>, <page-range>, <part-title>, <patent>, <person-group>, <postal-code>, <prefix>, <preformat>, <price>, <principal-award-recipient>, <principal-investigator>, <product>, <publisher-loc>, <publisher-name>, <rb>, <ref>, <ref-list>, <related-article>, <related-object>, <role>, <rt>, <season>, <sec>, <self-uri>, <series>, <size>, <source>, <speaker>, <speech>, <state>, <statement>, <std>, <std-organization>, <string-name>, <styled-content>, <subtitle>, <suffix>, <supplement>, <supplementary-material>, <table-wrap>, <target>, <term>, <textual-form>, <trans-source>, <trans-title>, <uri>, <verse-group>, <verse-line>, <version>, <volume>, <volume-id>, <volume-series>, <xref>, <year>
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 | @xml:lang is an optional attribute; there is no default. |
Example 1
Romanized Japanese name referred to as an “English” name:
...
<name name-style="western" xml:lang="en">
<surname>Sonoda</surname>
<given-names>Naoko</given-names>
</name>
...
Example 2
Within a citation, names the language of the book title (German) and a translated title
(English):
... <ref> <element-citation publication-type="book"> <person-group person-group-type="author"> <name><surname>Hartmeier</surname> <given-names>Winifried</given-names></name> </person-group> <source xml:lang="de">Immobilisierte Biokatalysstoren</source> <trans-source xml:lang="en">Immobilized biocatalysts</trans-source> <publisher-loc>Berlin</publisher-loc> ...</element-citation> </ref> ...