News for hackers. Stuff that matters.
Re:Translate This - Internationalize Your Site with a few li... by drfloob on Tuesday July 27, 2010 @09:00PM (#1553229)
Nice 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]); }
  }});