MediaWiki:Gadget-sidebartranslate.js

///////////////////////////////////////////////////////////////////////// // Translates the 'in other languages' list in the sidebar to English. // //                                                                    // //           From wikt:User:Bequw/sidebartranslate.js              // /////////////////////////////////////////////////////////////////////////

importScript('MediaWiki:langcode2name.js');

function languagereplace { //Can be caused by delay in timing if(typeof(langcode2name) == 'undefined'){ if(! document.callbacks_langcode ) document.callbacks_langcode = new Object; document.callbacks_langcode['sidebartranslate'] = languagereplace; return false; }

if (document.getElementById('p-lang')) { var LangNodes=document.getElementById('p-lang').getElementsByTagName('ul')[0].getElementsByTagName('li'); for( var x = 0; x < LangNodes.length; x++ ) { LangNodes[x].getElementsByTagName('a')[0].innerHTML = localtoEnglish(LangNodes[x].getElementsByTagName('a')[0].innerHTML); }	} }

$(languagereplace);

function localtoEnglish(localname) { return langcode2name(FLname2code(localname)) }