jQuery Translate


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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>

URL: http://webupd8.blogspot.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.