This page is protected against editing.

Template:BCP47

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

en

Template documentation[view·edit·history·purge]
This documentation istranscludedfromTemplate:BCP47/doc.

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 in the HTMLlang= ""attribute, or CSS language selectors (where BCP47 conformance is mandatory per their relevant standards), or in Wikidata for identifying the language of translated item labels and aliases (with language codes that all should all conform to BCP47). Don't use itnotfor interwiki codes (that are not necessarily BCP47 language codes, but used as domain names labels (also in internal Wikimedia database names) for Wikimedia projects designed to group one or several languages or variants in the same edition of the project and that may locally violate BCP 47 rules for verious legacy codes (even if some of them have been deprecated). Various non-Wikimedia projects may use other codes for their projects, but they are not directly supported unless they conform to BCP 47 (you may need other template to map language codes for these external projects). Do not assume that any interwiki code which is valid inside Wikimedia for wikilinks inserted in wiki pages is a valid BCP47 code.

As of August 2024, a new#bcp47 parser functionwas added which fully replaces this template. Please use{{#bcp47:...}}instead of{{BCP47|...}}template.

Usage

{{BCP47 |1= }}

Template parameters

<templatedata>JSON</templatedata>./.{{TemplateBox}}
TemplateData

TemplateDatais a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used byVisualEditorand possibly other tools likeUpload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use{{TemplateBox}}with either‎useTemplateData=1or‎useTemplateData=onlyon the‎/docsubpage and transcluding it with{{Documentation}}into the template.‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

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 the HTML lang= "" attribute.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
code1

The Wikimedia language code to convert to BCP47

Linerequired

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: all users

Localization

This template is not intended to be localized.

Examples

  • Unaffected codes, for example:
    • "{{#bcp47:en}}"returns:" en "
  • Changes required by BCP47, using standard codes:
    • "{{#bcp47:als}}"returns:" gsw "
    • "{{#bcp47:fiu-vro}}"returns:" vro "
    • "{{#bcp47:simple}}"returns:" en-simple "
    • "{{#bcp47:zh-classical}}"returns:" lzh "
    • "{{#bcp47:roa-rup}}"returns:" rup "
  • Changes required by BCP47, currently using private-use extensions:
    • "{{#bcp47:nrm}}"returns:" nrf "
    • "{{#bcp47:roa-tara}}"returns:" nap-x-tara "
  • Changes preferable with BCP47 for improved interoperability (not really violations):
    • "{{#bcp47:be-x-old}}"returns:" be-tarask "