Jump to content

User:TachyonJack/sidebartranslate.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
 /////////////////////////////////////////////////////////////////////////
 // Translates the 'in other languages' list in the sidebar to English. //
 //               Note: does not translate all languages                //
 //                                                                     //
 //                                By Tra                               //
 //                       (bug fix by Voice_of_All)                     //
 /////////////////////////////////////////////////////////////////////////


function languagereplace () {
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].href = localtoEnglish(LangNodes[x].getElementsByTagName('a')[0].href);
}
}
}

addOnloadHook (languagereplace)

function localtoEnglish(localname) {
//var retval='http://translate.google.com/translate?u='+localname;
return 'http://translate.google.com/translate?u='+localname;
//return localname;
}

}