3 ms·
Translate This - Internationalize Your Site with a few lines of JS
- drfloob 16y agoNice project. I'll be putting this script on my sites for sure. At first glance though, I didn't like that it translated the content of <pre> and <code> tags, so here's my quick fix for that. TranslateThis({onLoad: function(){ // avoids <pre> and <code> tags var nt= function(el){el.className+=" notranslate";}; var pres= document.getElementsByTagName('pre'); var codes= document.getElementsByTagName('code'); for(var i=0; i<pres.length; i++) { nt(pres[i]); } for(var i=0; i<codes.length; i++) { nt(codes[i]); } }});