Jump to content

Manual:$wgExtraInterlanguageLinkPrefixes

From mediawiki.org
Language, regional and character encoding settings: $wgExtraInterlanguageLinkPrefixes
Array of interwiki prefixes to be treated as language links.
Introduced in version:1.24.0 (Gerrit change 111390; git #7665f7d7)
Removed in version:Still in use
Allowed values:(array of strings)
Default value:[]

Details

By default, $wgInterwikiMagic only treats interwiki links as interlanguage links (i.e. moved to the "Languages" section of the sidebar) if the interwiki prefix matches one of the ISO language codes known to MediaWiki. From time to time, you may need to set up extra prefixes that are to be treated as interlanguage links (e.g. "mul" for a multilingual site).

This setting is ignored if $wgInterwikiMagic is set to false.

To set the display text for the interlanguage links generated by this code, you need to create "MediaWiki:Interlanguage-link-foo", where "foo" is the interwiki prefix. To provide a friendly site name for the link title text, use "MediaWiki:Interlanguage-link-sitename-foo".

Information about extra language links (in the site language only) is provided via the API in "meta=siteinfo&prop=interwikimap".

Example

Assume that there are three wikis, one holding the documentation, one containing demonstrations and one is serving as a sandbox.

In a first step you add the interwiki prefix for the demonstration and the sandbox wiki to the documentation wiki using e.g. the Interwiki extension: "demo" for <https://demo.software.wiki/page/$1> and "sand" for <https://sandbox.software.wiki/page/$1>.

Now you can set:

$wgExtraInterlanguageLinkPrefixes = [
	'demo',
	'sand'
];

This allows you to add [[demo:Demo for xyz-setting]] and [[sand:Sandbox for xyz setting]] to a wiki page. The wiki will now render "demo:Demo for xyz-setting" as well as "sand:Sandbox for xyz setting" in the sidebar and link to <https://demo.software.wiki/page/Demo_for_xyz-setting> and <https://sandbox.software.wiki/page/Sandbox_for_xyz_setting> respectively.

To add a link label for "demo:Demo for xyz-setting" as well as "sand:Sandbox for xyz setting" you can now edit the system message "MediaWiki:Interlanguage-link-demo" and add "Demonstration" as well as "MediaWiki:Interlanguage-link-sand" and add "Sandbox" on the documentation wiki. As a result the links will render as "Demonstration" and "Sandbox" respectively.

To enhance the popup label when you hover over the "Demonstration" link as well as the "Sandbox" link you can now on the documentation wiki edit the system message "MediaWiki:Interlanguage-link-sitename-demo" and add "Demonstration wiki" as well as "MediaWiki:Interlanguage-link-sitename-sand" and add "Sandbox wiki". As a result the popups will render as "Demo for xyz-setting - Demonstration wiki" and "Sandbox for xyz setting - Sandbox wiki" respectively instead of just "Demo for xyz-setting" and "Sandbox for xyz setting".

Since you are not linking to different language versions of your wiki you can now edit system message "MediaWiki:Otherlanguages" and change it from "In other languages" to e.g. "Related wiki pages".