MediaWiki:Gadget-WiktSidebarTranslation.js
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- The following documentation is located at MediaWiki:Gadget-WiktSidebarTranslation.js/documentation. [edit]
- This script is a part of the
WiktSidebarTranslation
gadget (edit definitions)- Description (edit): Translate sidebar interwiki links to English.
- Useful links: subpage list • links • redirects
See also: Special:Gadgets.
$(function(){
$("#p-lang .interlanguage-link a").each(function(){
var langnameMatch = $(this).attr("title").match(/(.*) – (.*)/);
var langname = $(this).attr("title"); //some wiktionaries like afrikaans have '' as their main page
if (langnameMatch && langnameMatch.length >= 3) langname = langnameMatch[2];
$(this).text(langname)
.attr("lang", "en");//this line breaks compact languages
});
$("#p-lang .interlanguage-link").sort(function(lia, lib){
return $(lia).children().first().text() < $(lib).children().first().text() ? -1 : 1;
}).appendTo("#p-lang>div>ul");
});