Wikisource:DoubleWiki Extension

From Wikisource
Jump to: navigation, search

About[edit]

The DoubleWiki extension displays an article and its translation on two columns of the same page. It was written specifically for Wikisource.

Syntax[edit]

The extension is enabled on all subdomains. To see it, add '?match=xx' to the url of a page, where 'xx' is the language code of an existing interlanguage link.

In wikis that have configured it, you may click on the "⇔" symbols near interlanguage links. In order to enable these symbols in your subdomain, copy the following function to your wiki's Common.js file (you must be a sysop to do this) or your user's javascript skin overrides, if enabled:

/*
Bilingual links
Functions through the DoubleWiki extension. 
Author: wikisource:fr:ThomasV, jQuery version by wikipedia:en:GreenReaper
*/
$(function(){
    var doc_url = document.URL;
    // iterate over all interlanguage links
    $('.interlanguage-link>a[hreflang]').each(function() {
      var lang = this.getAttribute("hreflang");
      var qm = doc_url.indexOf( doc_url.indexOf('?title=') != -1 ? '&match=' : '?' );
      var url = doc_url+"?match="+lang;
      if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang;
      this.outerHTML += "<a href='"+url+"'> ⇔</a>";
    })
})

Examples[edit]

Visit any of these pages, and click on the "⇔" symbols near interlanguage links:


See also[edit]