Template:Langcode/sandbox
en
Note to editors: Please don't categorize this template by editing it directly. Instead, place the category in its documentation page, in its "includeonly" section.
Please discuss proposed changes on the talk page first.
Editing a template causes all pages that use the template to be re-rendered. If the Template is used often, this can put a lot of load on the servers since it fills up the job queue. [statistics]
Usage
This template extracts the ISO 639 language identifier from the page name. Call simply as {{langcode}}. To keep compatibility with templates that use the {{langcode|{{{lang|}}}}} syntax this template returns its first argument if given. Note that this stops Mediawiki from caching the page, but this template is more optimised than older versions. Non-language prefixes such as Key:, Tag: and Relation: are handled correctly. Pages without a colon in the name are reported as the page content language set in the wiki (“Page content language” under “Page information”). This defaults to English for new pages. The page content language is always returned if it isn’t English.
Implementation
The arguments to #invoke are pseudonamespace/language pairs, for instance Key=en means that pages with names beginning with Key: are in English. Prefixes such as Pt: directly corresponding to languages do not have to be added here because the Scribunto module returns the beginning of the page name in lower case if it doesn’t match any of the arguments.
See also
- {{LangSwitch}}