User:Danski454/translate.js

$(function{	var lang = "en";	var text = "Translation";	var url = document.location.toString.replace(/#.*/, "");//get url w/o fragment	if (typeof window.translateLang === "string" && window.translateLang){		lang = window.translateLang; // use window.translateLang = "es"; to switch target to spanish (for example)	}	if (typeof window.inactiveLang === "string" && window.inactiveLang === mw.config.get("wgContentLanguage")){		return; // use window.inactiveLang = translateLang; to disable transaltion for your native language	}	if (typeof window.translateText === "string" && window.translateText){		text = window.translateText; // use window.translateText = "Something"; to localise link text	}	//force current skin to be used	if (url.match(/\?/)) {		url = url + '&useskin=' + mw.config.get('skin');	} else {		url = url + '?useskin=' + mw.config.get('skin');	}	mw.util.addPortletLink ("p-tb", "https://translate.google.com/translate?sl=auto&tl=" + lang + "&u=" + encodeURIComponent(url), text, "tb-translate"); });