Extension:Interlanguage

The Interlanguage extension aims to ease the handling of interlanguage links. From A newer look at the interwiki link:


 * As the Wikimedia projects grow, more articles are written about the same subject in different languages. When one interlanguage link is added in one project it will eventually be added to the other as well. In the case where 20 languages have an article on the same subject, each article should link to 19 other languages, so there are 20*19=380 links to edit and maintain. In case of 100 languages, the number of interlanguage links will amount to nearly 10,000.

Usage
The extension avoids this problem by fetching interlanguage links from another wiki (further: central wiki) whenever a page is saved (or purged). Central wiki may be a separate wiki, or one of the existing wikis. The extension itself need not be installed on the central wiki.

On the central wiki, interlanguage links are maintained the same way they are on any MediaWiki wiki. On wikis with the Interlanguage Extension installed, interlanguage links could now be added by writing  , which will fetch all the interlanguage links from the central wiki page "article name". When a new interlanguage link is added to the central wiki, articles on the projects need to be purged in order to update their interlanguage links. If the article on the central wiki doesn't exist, a red link towards it will be made so that it could be easily created.

The extension doesn't interfere with usual working of interlanguage links. They may continue to be used in parallel to the extension.

Installation
Copy/paste the source files into your extensions/ directory, then add the following to your LocalSettings.php:

Variable $wgInterlanguageExtensionApiUrl tells the extension where to find MediaWiki API of the central wiki. It is necessary to correctly set this variable, or the extension won't work properly. For example, if you would want to fetch interlanguage links from English Wikipedia (which you may do for testing purposes), the URL should be 'http://en.wikipedia.org/w/api.php '. This variable is mandatory and the extension can't function without it.

Variable $wgInterlanguageExtensionInterwiki tells the extension what is the interwiki prefix of the central wiki, which will be used to create link towards it if needed. It must include the colon at the end of the prefix. For example, if you are fetching interlanguage links from English Wikipedia, it should be set to 'wikipedia:'. This variable is mandatory and the extension can't properly function without it.

Variable $wgInterlanguageExtensionSort selects sort method you want to use for the interwikis. Currently, it recognises four sort methods: This variable may be omitted, in which case the 'none' sort mode will be used.
 * 'code'</tt>: By language code
 * 'alphabetic'</tt>: By language name
 * 'alphabetic_revised'</tt>: By language name (alternative)
 * 'none'</tt>: Don't sort. Use the same order as on the central wiki.

Variable $wgInterlanguageExtensionSortPrepend</tt> modifies the sort method so that it sorts certain languages at the top of the list of languages, regardless of their general sort order. It should be set to an array that has values set to desired language codes, in desired order. For example, to put English and then Simple English at the top of the list of languages, set it to array( 'en', 'simple' )</tt>. This variable may be omitted, in which case the sort will be used unmodified.

Variable $wgInterlanguageExtensionPrefix</tt> tells the extension to use a namespace or a subpage on the central wiki. All page names will be prepended with it before the interlanguage links are fetched from the central wiki. It must include the colon or the slash at the end of the prefix. This variable may be omitted, in which case no prefix will be used.

1.0
June 10 2008: Initial release

1.1
November 14 2008: Increased robustness and usability, more options.


 * Uses MediaWiki's Http::get</tt> instead of file_get_contents</tt> &mdash; much better response if the central wiki is down.
 * No longer uses hash:  </tt> instead of   </tt>.
 * If API request fails, keep existing interlanguage links.
 * If the central wiki doesn't have the requested page, display a red link to it.
 * New configuration parameter $wgInterlanguageExtensionInterwiki</tt>, for the interwiki prefix of the central wiki.
 * New configuration parameter $wgInterlanguageExtensionPrefix</tt>, enables using a namespace or a subpage on the central wiki.
 * New configuration parameter $wgInterlanguageExtensionSortPrepend</tt>, enables using a custom sort order.
 * Take care of API's lllimit</tt> parameter.
 * Updated language sorting to take care of new languages.
 * More code comments.