User:Wynndale/langcode/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

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 English although local project pages may not be.

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