Template:BCP47/doc: Difference between revisions
Template page
More actions
| Line 10: | Line 10: | ||
* Unaffected codes, for example: | * Unaffected codes, for example: | ||
** "<code><nowiki>{{BCP47|en}}</nowiki></code>" returns: "{{BCP47|en}}" | ** "<code><nowiki>{{BCP47|en}}</nowiki></code>" returns: "{{BCP47|en}}" | ||
** "<code><nowiki>{{BCP47|zh-hans}}</nowiki></code>" returns: "{{BCP47|zh-hans}}" | |||
** "<code><nowiki>{{BCP47|zh-hant}}</nowiki></code>" returns: "{{BCP47|zh-hant}}" | ** "<code><nowiki>{{BCP47|zh-hant}}</nowiki></code>" returns: "{{BCP47|zh-hant}}" | ||
** "<code><nowiki>{{BCP47|zh-cn}}</nowiki></code>" returns: "{{BCP47|zh-cn}}" | ** "<code><nowiki>{{BCP47|zh-cn}}</nowiki></code>" returns: "{{BCP47|zh-cn}}" | ||
* Changes preferable with BCP47 for improved interoperability (not really violations): | |||
** "<code><nowiki>{{BCP47|be-x-old}}</nowiki></code>" returns: "{{BCP47|be-x-old}}" | |||
** "<code><nowiki>{{BCP47|zh-yue}}</nowiki></code>" returns: "{{BCP47|zh-yue}}" | |||
** "<code><nowiki>{{BCP47|zh-cmn}}</nowiki></code>" returns: "{{BCP47|zh-cmn}}" (alias of "zh"?) | |||
* The following codes are not recommended (they are unnecessary aliases) but they are still conforming to the standard and are not affected (this template still does not resolve them to their canonical codes): | * The following codes are not recommended (they are unnecessary aliases) but they are still conforming to the standard and are not affected (this template still does not resolve them to their canonical codes): | ||
** "<code><nowiki>{{BCP47|en-latn}}</nowiki></code>" returns: "{{BCP47|en-latn}}" (alias of "en") | ** "<code><nowiki>{{BCP47|en-latn}}</nowiki></code>" returns: "{{BCP47|en-latn}}" (alias of "en"?) | ||
** "<code><nowiki>{{BCP47|zh- | ** "<code><nowiki>{{BCP47|zh-cmn-hans-cn}}</nowiki></code>" returns: "{{BCP47|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: | * Changes required by BCP47 (due to standard violation), using standard codes when they exist: | ||
** "<code><nowiki>{{BCP47|als}}</nowiki></code>" returns: "{{BCP47|als}}" | ** "<code><nowiki>{{BCP47|als}}</nowiki></code>" returns: "{{BCP47|als}}" | ||
| Line 29: | Line 31: | ||
** "<code><nowiki>{{BCP47|nrm}}</nowiki></code>" returns: "{{BCP47|nrm}}" | ** "<code><nowiki>{{BCP47|nrm}}</nowiki></code>" returns: "{{BCP47|nrm}}" | ||
** "<code><nowiki>{{BCP47|roa-tara}}</nowiki></code>" returns: "{{BCP47|roa-tara}}" | ** "<code><nowiki>{{BCP47|roa-tara}}</nowiki></code>" returns: "{{BCP47|roa-tara}}" | ||
<includeonly> | <includeonly> | ||
<!-- template categories and interwiki links --> | <!-- template categories and interwiki links --> | ||
</includeonly> | </includeonly> | ||
Revision as of 08:44, 19 November 2013
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, for example:
- "
{{BCP47|en}}" returns: "en" - "
{{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):
- "
{{BCP47|be-x-old}}" returns: "be-tarask" - "
{{BCP47|zh-yue}}" returns: "yue" - "
{{BCP47|zh-cmn}}" returns: "cmn" (alias of "zh"?)
- "
- The following codes are not recommended (they are unnecessary aliases) 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:
- "
{{BCP47|als}}" returns: "gsw" - "
{{BCP47|fiu-vro}}" returns: "vro" - "
{{BCP47|roa-rup}}" returns: "rup" - "
{{BCP47|simple}}" returns: "en" - "
{{BCP47|zh-classical}}" returns: "lzh"
- "
- Changes required by BCP47 (due to standard violation), currently using private-use extensions:
- "
{{BCP47|de-formal}}" returns: "de" - "
{{BCP47|nl-informal}}" returns: "nl" - "
{{BCP47|nrm}}" returns: "nrf" - "
{{BCP47|roa-tara}}" returns: "it-x-tara"
- "