Extension:ExtraLanguageLink

The ExtraLanguageLink extension allows you to add additional links to the "Languages" sidebar section on a given page, by way of a parser function/magic word embedded in the page's wikitext.

Usage
The  magic word has the following syntax: {{extralanguagelink: | |class= |style= |title= |lang= |hreflang= }} Only the link target is required: all other parameters are optional. Localised names for the parameters may be available.

Technical stuff
If extra language links are not allowed on the current page (see below), the parser function will fail silently – no error message will be shown. This is done so that a page containing  (e.g. the Main Page) can be transcluded onto any other page without spewing errors.

If a disallowed interwiki prefix is used (see below), or if an invalid title is supplied, an error message will be shown.

If setting up CSS styling on extra language links, be aware of the fact that the  attribute supplied to the parser function is applied to the   tag (the link itself), while the   attribute is applied to the tag that contains the link (  in most skins,   in Cologne Blue).

Configuration parameters
To restrict the use of this extension to certain interwiki prefixes, set  to an array of allowed interwiki prefixes. Prefixes must be in lowercase only!
 * $wgExtraLanguageLinkAllowedPrefixes

The empty string  can be added to the array if you wish to allow extra language links to local pages.

The default value is, meaning that   accepts all local and interwiki links.

For example, $wgExtraLanguageLinkAllowedPrefixes = array( 'wikipedia', 'wiktionary', 'c2' ); would allow  but not   or.

Set  to an array of page titles on the wiki where the   parser function is allowed to be used. The default value is, which allows its use on all pages.
 * $wgExtraLanguageLinkAllowedTitles

Use spaces, not underscores, in this array.

For example: $wgExtraLanguageLinkAllowedTitles = array( 'Main Page', 'Help:Contents' );

Scenarios
Here are some scenarios in which this extension may be useful.

These are Wikimedia-specific examples, but this extension is general in nature, and these examples can be easily adapted to other sites. (Perhaps you might need to add some rows to your first.)


 * 1. Adding a "Complete list" link to the language links of a Wikipedia main page
 * In the wiki's configuration, set:

 $wgExtraLanguageLinkAllowedPrefixes = array( 'm' ); $wgExtraLanguageLinkAllowedTitles = array( 'Main Page' ); 
 * On the Main Page, place:


 * 2. Adding a "More languages" link to a Wikisource page
 * Some languages do not have their own version of Wikisource, so texts in those languages are hosted at Multilingual Wikisource. It might be good to add a link across to Multilingual Wikisource from the texts on language-specific domains.
 * In the wiki's configuration, set:
 * $wgExtraLanguageLinkAllowedPrefixes = array( 'oldwikisource' );
 * Create a template, say "Template:Mul-link", with the following content, or similar:
 * Then transclude the template as needed:
 * Then transclude the template as needed: