Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Translate This - Internationalize Your Site with a few lines of JS (translateth.is)
11 points by byoung2 on July 27, 2010 | hide | past | favorite | 1 comment



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]); }
  }});




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: