Template:Langcode/doc

From Second Life Wiki
< Template:Langcode
Revision as of 08:13, 13 September 2022 by Gwyneth Llewelyn (talk | contribs) (Shamelessly copied from wiki.openstreetmap.org)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

exclamation mark

Note: This template is used on a lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum.
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