Posted By

hotice on 07/17/09


Tagged

jquery translate


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Alphawolf
erlhal


jQuery Translate


 / Published in: JavaScript
 

URL: http://webupd8.blogspot.com

  1. <script type='text/javascript'>
  2. $(document).ready(function(){
  3. $.getScript('http://jquery-translate.googlecode.com/files/jquery.translate-1.3.2.min.js', function(){ //when the script is loaded
  4. $.translate(function(){ //when the Google Language API is loaded
  5. $.translate().ui('select', 'option') //generate dropdown
  6.  
  7.  
  8. .change(function(){
  9. $('#translateit').translate( 'en', { //revert to english first
  10. not: 'select, pre'
  11. })
  12.  
  13. .translate( 'en', $(this).val(), {
  14. not: 'select, pre',
  15. async: true,
  16. toggle: true,
  17. walk: false
  18. });
  19. })
  20. .val('English') //select English as default
  21. .appendTo('#nav'); //insert the dropdown to the page
  22. });
  23. });
  24. });
  25. </script>

Report this snippet  

You need to login to post a comment.