Template:BCP47/doc
Template page
More actions
Usage
This template fixes the current violations of the BCP47 standard (for inclusion in the lang HTML attribute) by Wikimedia sites for their language codes.
It also normalizes these codes to lowercase only (though it is not mandatory).
Use this template only in HTML lang="" attributes, in XML xml:lang="" pseudo-attributes, or in CSS lang() selectors.
Examples
- Unaffected codes (most of them, valid for use HTML/XML/CSS, are not valid interwikis), for example:
- "
{{BCP47|en}}" returns: "en" - "
{{BCP47|nb}}" returns: "nb" (same as "no" only where it's used by interwikis on Wikimedia sites) - "
{{BCP47|zh-hans}}" returns: "zh-hans" - "
{{BCP47|zh-hant}}" returns: "zh-hant" - "
{{BCP47|zh-cn}}" returns: "zh-cn"
- "
- Changes preferable with BCP47 for improved interoperability (not really violations, these replacements for HTML/XML/CSS should not be used for interwikis, as long as their domain names are not aliased):
- "
{{BCP47|be-x-old}}" returns: "be-tarask" - "
{{BCP47|mo}}" returns: "ro-cyrl" - "
{{BCP47|no-bok}}" returns: "nb" (same as "no"only where it's used by interwikis on Wikimedia sites) - "
{{BCP47|no-nyn}}" returns: "nn" - "
{{BCP47|zh-cmn}}" returns: "cmn" (alias of "zh" on Wikimedia sites ?) - "
{{BCP47|zh-wuu}}" returns: "wuu" - "
{{BCP47|zh-yue}}" returns: "yue"
- "
- The following codes are not recommended (they are unnecessary aliases with preferred values) but they are still conforming to the standard and are not affected (this template still does not resolve them to their canonical codes):
- "
{{BCP47|en-latn}}" returns: "en-latn" (alias of "en"?) - "
{{BCP47|zh-cmn-hans-cn}}" returns: "zh-cmn-hans-cn" (alias of "cmn-hans-cn"? or simply "zh-hans-cn"?)
- "
- Changes required by BCP47 (due to standard violation), using standard codes when they exist (but these replacements for HTML/XML/CSS conformance are not valid in interwikis, as long as their domains are not aliased):
- "
{{BCP47|als}}" returns: "gsw" - "
{{BCP47|bat-smg}}" returns: "sgs" - "
{{BCP47|fiu-vro}}" returns: "vro" - "
{{BCP47|roa-rup}}" returns: "rup" - "
{{BCP47|simple}}" returns: "en" - "
{{BCP47|sr-sc}}" returns: "sr-sc" - "
{{BCP47|sr-sl}}" returns: "sr-sl" - "
{{BCP47|zh-classical}}" returns: "lzh"
- "
- Changes required by BCP47 (due to standard violation), currently using private-use extensions:
- "
{{BCP47|cbk-zam}}" returns: "cbk-x-zam" - "
{{BCP47|de-formal}}" returns: "de" - "
{{BCP47|eml}}" returns: "egl" - "
{{BCP47|map-bms}}" returns: "jv-x-bms" - "
{{BCP47|nl-informal}}" returns: "nl" - "
{{BCP47|nrm}}" returns: "nrf" - "
{{BCP47|roa-tara}}" returns: "it-x-tara"
- "