User:Ricordisamoa/translate.js

From Wikipedia, the free encyclopedia
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.
mw.loader.using( 'mediawiki.util', function () {
$( document ).ready( function () {
if(document.getElementsByClassName('interwiki-it').length==0){
mw.util.addPortletLink ( 'p-lang',
"http://translate.google.it/translate?sl="+document.location.hostname.toString().split('.')[0]+"&tl=it&u="+encodeURIComponent(document.location.toString()),
'Italiano (tradotto con Google)', 'pt-translate-it-google', 'La voce non è presente in italiano.\nClicca qui per tradurla automaticamente');
mw.util.addPortletLink ( 'p-lang',
"http://www.microsofttranslator.com/bv.aspx?from="+document.location.hostname.toString().split('.')[0]+"&to=it&a="+encodeURIComponent(document.location.toString()),
'Italiano (tradotto con Bing)', 'pt-translate-it-bing', 'La voce non è presente in italiano.\nClicca qui per tradurla automaticamente');
}
} );
} );